-
Notifications
You must be signed in to change notification settings - Fork 53
Automatically deploy to example mod #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 51 commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
db6b08a
Add a deployment workflow
CelDaemon addb8cc
Also rerun when self changed
CelDaemon 6a5172e
Fix up the matrix
CelDaemon aa57969
Make deploy jobs depend on build
CelDaemon 0dedd2a
Rename typo 'depends' -> 'depend'
CelDaemon 1d90446
Rename 'depend' -> 'needs'
CelDaemon b402333
Run buildLib before bundling cli
CelDaemon 7b10fcc
Use `deno run` subcommand to run CLI
CelDaemon 47c0845
Use correct CLI path
CelDaemon d0ab854
Use correct -m flag to specify modid
CelDaemon 927de2d
Clean directory before regenerating
CelDaemon 43ccc17
Also delete entries starting with a dot
CelDaemon 9164bd8
Generate in a separate directory
CelDaemon eb9dceb
Set splitSources and mojangMappings
CelDaemon 6ab7106
Set repo as working dir for Git steps
CelDaemon 8d733d1
Include entries starting with a dot in template
CelDaemon cbb6c3b
Prevent enabling unsupported options
CelDaemon 7d9ef87
Ensure deploy gets triggered on CLI changes
CelDaemon 9db72d2
Don't crash when nothing has changed
CelDaemon 98e8900
Add 1.14-1.16
CelDaemon aebeb5e
Allow CI to create new version branches
CelDaemon 8874ef1
Fix new branches to be created from master
CelDaemon dfa78d2
Don't wait for timeout to create new branches
CelDaemon 14e7ec6
Query remote branches instead
CelDaemon 510eb75
Fetch before switching branch
CelDaemon 21cec16
Don't manually clean working tree
CelDaemon 979537e
Don't use working directory to check for changes
CelDaemon 0c68309
Remove redundant file copy
CelDaemon e48530d
Fix template deploy not triggering
CelDaemon b0e1c08
Attempt looking up minecraft versions during deploy
CelDaemon 034666a
Filter for latest of every supported major version
CelDaemon 066d688
Add dynamic matrix input
CelDaemon 8b1325e
Remove unnecessary compat check
CelDaemon ba7e800
Use reduce over mutating state
CelDaemon 244550e
Use standalone typescript file for scripts
CelDaemon 812bb86
Give template version lookup access to net
CelDaemon 464b749
Prevent output deprecation warning
CelDaemon ee3ee4a
Remove extra dependencies
CelDaemon 0eadecd
Name CI jobs and steps
CelDaemon ad2cba0
Ensure correct handling of concurrency
CelDaemon a680c61
Only deploy run on pushes to main
CelDaemon 6b87570
Reference repository relative to org
CelDaemon 8a2d7b9
Add README.md to deployed template
CelDaemon 1cdd0f1
Allow running the deployment workflow manually
CelDaemon 70b7e93
Add target version in step names
CelDaemon 8fe03cc
Revert "Add README.md to deployed template"
CelDaemon 08f7c5c
Use FabricMCBot as bot user
CelDaemon a49e2d4
Run deployment weekly instead of on every push
CelDaemon aa64852
Filter out unsupported versions
CelDaemon 16485d5
Generate branches for all stable versions
CelDaemon 16fba4d
Use version for branch name directly
CelDaemon 0889069
Rename deploy key secret
CelDaemon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| // @deno-types="../../scripts/dist/fabric-template-generator.d.ts" | ||
| import { getTemplateGameVersions } from '../../scripts/dist/fabric-template-generator.js'; | ||
|
|
||
| console.log(JSON.stringify((await getTemplateGameVersions()).filter(x => x.stable).map(x => x.version))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| name: Deploy to Fabric Example Mod | ||
| on: | ||
| workflow_dispatch: | ||
| schedule: | ||
| - cron: 37 7 * * SAT | ||
|
|
||
| jobs: | ||
| build: | ||
| name: Build Fabric CLI | ||
| runs-on: ubuntu-24.04 | ||
| outputs: | ||
| versions: ${{ steps.versions-lookup.outputs.result }} | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v6 | ||
| - name: Setup NodeJS | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: 18 | ||
| - name: Setup Deno | ||
| uses: denoland/setup-deno@v2 | ||
| with: | ||
| deno-version: "2.1.10" | ||
| - name: Install NPM dependencies | ||
| run: npm i | ||
| working-directory: scripts | ||
| - name: Build template library | ||
| run: npm run buildLib | ||
| working-directory: scripts | ||
| - name: Build Fabric CLI | ||
| run: make build | ||
| working-directory: cli | ||
| - name: Upload Fabric CLI | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: cli | ||
| path: cli/bundled.ts | ||
| - name: Look up template versions | ||
| run: echo "result=$(deno run --allow-net .github/scripts/template-versions.ts)" >> "$GITHUB_OUTPUT" | ||
| id: versions-lookup | ||
| deploy: | ||
| name: Deploy ${{ matrix.version }} template | ||
| runs-on: ubuntu-24.04 | ||
| needs: build | ||
| concurrency: | ||
| group: deploy-${{ matrix.version }} | ||
| strategy: | ||
| matrix: | ||
| version: ${{ fromJSON(needs.build.outputs.versions) }} | ||
| steps: | ||
| - name: Setup Deno | ||
| uses: denoland/setup-deno@v2 | ||
| with: | ||
| deno-version: "2.1.10" | ||
| - name: Download Fabric CLI | ||
| uses: actions/download-artifact@v8 | ||
| with: | ||
| name: cli | ||
| - name: Checkout template repository | ||
| uses: actions/checkout@v6 | ||
| id: existing-checkout | ||
| with: | ||
| repository: ${{ github.repository_owner }}/fabric-example-mod | ||
| path: repo | ||
| ssh-key: ${{ secrets.DEPLOY_KEY }} | ||
|
modmuss50 marked this conversation as resolved.
Outdated
|
||
| - name: Switch to ${{ matrix.version }} branch | ||
| run: | | ||
| if git ls-remote --exit-code --quiet origin '${{ matrix.version }}' | ||
| then | ||
| git fetch origin '${{ matrix.version }}' | ||
| git switch '${{ matrix.version }}' | ||
| else | ||
| git switch --orphan '${{ matrix.version }}' | ||
| fi | ||
| working-directory: repo | ||
| - name: Create template directory | ||
| run: mkdir gen | ||
| - name: Generate ${{ matrix.version }} template | ||
| run: deno run -A ../bundled.ts init -n 'Example Mod' -m modid -p 'com.example' -v '${{ matrix.version }}' -o splitSources -o mojangMappings | ||
| working-directory: gen | ||
| - name: Set commit user | ||
| run: | | ||
| git config user.name 'Fabric Bot' | ||
| git config user.email 159731069+FabricMCBot@users.noreply.github.com | ||
| working-directory: repo | ||
| - name: Commit changes | ||
| run: | | ||
| git --work-tree ../gen add . | ||
| git diff-index --quiet --cached HEAD || git commit -m 'Deployment from commit ${{ github.repository }}@${{ github.sha }}' | ||
| working-directory: repo | ||
| - name: Push to ${{ matrix.version }} | ||
| run: git push -u origin '${{ matrix.version }}' | ||
| working-directory: repo | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.