@@ -13,18 +13,27 @@ jobs:
1313 runs-on : ubuntu-latest
1414 timeout-minutes : 10
1515 steps :
16- - uses : actions/checkout@v4
17-
16+ - uses : actions/checkout@v5
17+
1818 - name : Set up JDK
19- uses : actions/setup-java@v4
19+ uses : actions/setup-java@v5
2020 with :
2121 java-version : ' 21'
2222 distribution : ' temurin'
23- cache : ' gradle'
24-
23+
24+ - name : Try restore Gradle Cache
25+ uses : actions/cache/restore@v4
26+ with :
27+ path : |
28+ ~/.gradle/caches
29+ ~/.gradle/wrapper
30+ key : ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
31+ restore-keys : |
32+ ${{ runner.os }}-gradle-build-
33+
2534 - name : Build
2635 run : ./gradlew build --info
27-
36+
2837 - name : Check for uncommited changes
2938 run : |
3039 if [[ "$(git status --porcelain)" != "" ]]; then
@@ -50,13 +59,13 @@ jobs:
5059 outputs :
5160 upload_url : ${{ steps.create_release.outputs.upload_url }}
5261 steps :
53- - uses : actions/checkout@v4
54-
62+ - uses : actions/checkout@v5
63+
5564 - name : Configure Git
5665 run : |
5766 git config --global user.email "actions@github.com"
5867 git config --global user.name "GitHub Actions"
59-
68+
6069 - name : UN-Snap version and output
6170 id : version
6271 run : |
@@ -71,21 +80,27 @@ jobs:
7180
7281 echo "Contents of gradle.properties"
7382 cat gradle.properties
74-
83+
7584 - name : Get metadata
7685 id : metadata
7786 run : |
78- archives_base_name =$(grep -Po 'archives_base_name =\K.*' gradle.properties)
79- echo "archives_base_name=$archives_base_name " >> $GITHUB_OUTPUT
80-
87+ archivesBaseName =$(grep -Po 'archivesBaseName =\K.*' gradle.properties)
88+ echo "archivesBaseName=$archivesBaseName " >> $GITHUB_OUTPUT
89+
8190 - name : Commit and Push
8291 run : |
8392 git add -A
8493 git commit -m "Release ${{ steps.version.outputs.release }}"
8594 git push origin
8695 git tag v${{ steps.version.outputs.release }}
8796 git push origin --tags
88-
97+
98+ - id : check-for-curseforge
99+ run : |
100+ [ -z $CURSEFORGE_TOKEN ] || echo "has=true" >> "$GITHUB_OUTPUT"
101+ env :
102+ CURSEFORGE_TOKEN : ${{ secrets.CURSEFORGE_TOKEN }}
103+
89104 - name : Create Release
90105 id : create_release
91106 uses : shogo82148/actions-create-release@v1
@@ -99,31 +114,40 @@ jobs:
99114
100115 ## Installation
101116 The mod can be downloaded from
102- * [Modrinth](https://modrinth.com/mod/${{ steps.metadata.outputs.archives_base_name }})
103- * [CurseForge](https://www.curseforge.com/minecraft/mc-mods/${{ steps.metadata.outputs.archives_base_name }})
117+ * [Modrinth](https://modrinth.com/mod/${{ steps.metadata.outputs.archivesBaseName }})
104118 * the GitHub release assets below
105119 * [Maven Central](https://repo.maven.apache.org/maven2/net/litetex/mcm/)
120+ ${{ (steps.check-for-curseforge.outputs.has) && format('[CurseForge](https://www.curseforge.com/minecraft/mc-mods/{0})', steps.metadata.outputs.archivesBaseName) || '' }}
106121
107122 publish :
108123 runs-on : ubuntu-latest
109124 needs : [prepare_release]
110125 timeout-minutes : 60
111126 steps :
112- - uses : actions/checkout@v4
113-
127+ - uses : actions/checkout@v5
128+
114129 - name : Set up JDK
115- uses : actions/setup-java@v4
130+ uses : actions/setup-java@v5
116131 with :
117132 distribution : ' temurin'
118133 java-version : 21
119- cache : ' gradle'
134+
135+ - name : Try restore Gradle Cache
136+ uses : actions/cache/restore@v4
137+ with :
138+ path : |
139+ ~/.gradle/caches
140+ ~/.gradle/wrapper
141+ key : ${{ runner.os }}-gradle-build-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
142+ restore-keys : |
143+ ${{ runner.os }}-gradle-build-
120144
121145 - name : Init Git and pull
122146 run : |
123147 git config --global user.email "actions@github.com"
124148 git config --global user.name "GitHub Actions"
125149 git pull
126-
150+
127151 - name : Build and publish
128152 run : ./gradlew clean build modrinth --info --stacktrace
129153 env :
@@ -148,8 +172,15 @@ jobs:
148172 SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_USERNAME }}
149173 SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN : ${{ secrets.SONATYPE_MAVEN_CENTRAL_PORTAL_TOKEN }}
150174
175+ - id : check-for-curseforge
176+ run : |
177+ [ -z $CURSEFORGE_TOKEN ] || echo "has=true" >> "$GITHUB_OUTPUT"
178+ env :
179+ CURSEFORGE_TOKEN : ${{ secrets.CURSEFORGE_TOKEN }}
180+
151181 - name : Publish to CurseForge
152182 uses : Kira-NT/mc-publish@995edadc13559a8b28d0b7e6571229f067ec7659 # v3
183+ if : ${{ steps.check-for-curseforge.outputs.has }}
153184 with :
154185 curseforge-id : 1291862
155186 curseforge-token : ${{ secrets.CURSEFORGE_TOKEN }}
@@ -162,14 +193,14 @@ jobs:
162193 needs : [publish]
163194 timeout-minutes : 10
164195 steps :
165- - uses : actions/checkout@v4
166-
196+ - uses : actions/checkout@v5
197+
167198 - name : Init Git and pull
168199 run : |
169200 git config --global user.email "actions@github.com"
170201 git config --global user.name "GitHub Actions"
171202 git pull
172-
203+
173204 - name : Inc Version and SNAP root
174205 run : |
175206 originalVersion=$(grep -Po 'mod_version=\K.*' gradle.properties)
@@ -185,7 +216,7 @@ jobs:
185216 git add -A
186217 git commit -m "Preparing for next development iteration"
187218 git push origin
188-
219+
189220 - name : pull-request
190221 env :
191222 GH_TOKEN : ${{ github.token }}
0 commit comments