11# Experimental workflow to automate updating to a new Minecraft snapshot.
2-
3- # Currently this is very similar to the semi-automatic scripts I already use,
4- # but moving them to GitHub Actions means I don't have to be around to start
5- # them. This should allow for further automation in the future.
6-
7- # TODO:
8- # - Add more thorough automated testing where it runs the game, creates a test
9- # world and takes screenshots, similar to what Fabric API does in their
10- # GitHub Actions workflow.
11- # - Set up a server to trigger this workflow when a new snapshot is out and
12- # Fabric has updated to it. This might end up running twice per snapshot,
13- # because there is no way to know ahead of time if the previous Fabric API
14- # build still works or if we have to wait for a new build made specifically
15- # for the new snapshot.
16- # - Add a step to automatically release the new snapshot build if all tests
17- # have passed. This will only ever run on small snapshots that don't break
18- # anything, but should save a ton of time at the end of each snapshot cycle
19- # when Mojang is spamming tiny pre-releases every day.
20-
21- # In case it isn't obvious, these todos are very ambitious and might not end
22- # up working as planned.
23-
242name : Auto Snapshot Update
253
264on :
5331 runs-on : ubuntu-latest
5432 steps :
5533
56- - name : Echo distinct ID ${{ github.event. inputs.distinct_id }}
57- run : echo ${{ github.event. inputs.distinct_id }}
34+ - name : Echo distinct ID ${{ inputs.distinct_id }}
35+ run : echo ${{ inputs.distinct_id }}
5836
5937 - name : Checkout repository
6038 uses : actions/checkout@v5
@@ -80,22 +58,25 @@ jobs:
8058 build-scan-terms-of-use-url : " https://gradle.com/help/legal-terms-of-use"
8159 build-scan-terms-of-use-agree : " yes"
8260
83- - name : Run migrateMappings task
61+ - name : Migrate mappings for main source set
8462 run : |
85- ./gradlew migrateMappings --mappings ${{ github.event.inputs.yarn_mappings }}
63+ ./gradlew migrateMappings --mappings ${{ inputs.yarn_mappings }} --input "src/main/java" --output "src/main/java_"
64+ rm -rf ./src/main/java
65+ mv ./src/main/java_ ./src/main/java
8666
87- - name : Replace src/main/java with remapped files
67+ - name : Migrate mappings for test source set
8868 run : |
89- rm -rf ./src/main/java
90- mv ./remappedSrc ./src/main/java
69+ ./gradlew migrateMappings --mappings ${{ inputs.yarn_mappings }} --input "src/test/java" --output "src/test/java_"
70+ rm -rf ./src/test/java
71+ mv ./src/test/java_ ./src/test/java
9172
9273 - name : Update version constants
9374 run : |
9475 python scripts/update_version_constants.py \
95- "${{ github.event. inputs.mc_version }}" \
96- "${{ github.event. inputs.yarn_mappings }}" \
97- "${{ github.event. inputs.fabric_loader }}" \
98- "${{ github.event. inputs.fapi_version }}"
76+ "${{ inputs.mc_version }}" \
77+ "${{ inputs.yarn_mappings }}" \
78+ "${{ inputs.fabric_loader }}" \
79+ "${{ inputs.fapi_version }}"
9980
10081 # To fix any style issues that the migration scripts might cause
10182 - name : Run spotlessApply task
10687 git config --global user.name "Wurst-Bot"
10788 git config --global user.email "[email protected] " 10889 git add .
109- git commit -m "[Wurst-Bot] Update to ${{ github.event. inputs.mc_version }}"
90+ git commit -m "[Wurst-Bot] Update to ${{ inputs.mc_version }}"
11091 git push
11192
11293 - name : Trigger CI
11596 with :
11697 token : ${{ github.token }}
11798 owner : Wurst-Imperium
118- repo : Wurst7
99+ repo : ${{ github.event.repository.name }}
119100 ref : ${{ github.ref }}
120101 workflow : gradle.yml
121102
@@ -124,6 +105,6 @@ jobs:
124105 with :
125106 token : ${{ github.token }}
126107 owner : Wurst-Imperium
127- repo : Wurst7
108+ repo : ${{ github.event.repository.name }}
128109 run_id : ${{ steps.ci_dispatch.outputs.run_id }}
129110 run_timeout_seconds : 600 # 10 minutes
0 commit comments