-
Notifications
You must be signed in to change notification settings - Fork 69
290 lines (250 loc) · 8.31 KB
/
tagged-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
# Creates releases on Curseforge and Github Releases based on v* tags
name: Tagged Commit Release
on:
workflow_dispatch:
jobs:
vars:
name: Gather Variables
runs-on: ubuntu-20.04
outputs:
release_type: ${{steps.cf_release_type.outputs.value }}
cf_project: ${{steps.cf_project.outputs.value }}
mod_id: ${{steps.mod_id.outputs.value }}
version: ${{steps.version.outputs.version }}
build: ${{steps.build.outputs.buildver}}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Release Type
id: cf_release_type
uses: christian-draeger/read-properties@1.1.1
with:
path: './gradle.properties'
property: 'cf_release_type'
- name: Project ID
id: cf_project
uses: christian-draeger/read-properties@1.1.1
with:
path: './gradle.properties'
property: 'cf_project'
- name: Mod ID
id: mod_id
uses: christian-draeger/read-properties@1.1.1
with:
path: './gradle.properties'
property: 'mod_id'
- name: Find Current Tag
id: current
uses: jimschubert/query-tag-action@v2
with:
include: 'v*'
exclude: '*-rc*'
commit-ish: '@'
skip-unshallow: 'true'
- name: Semver Version
id: version
run: |
version=$(echo "${{steps.current.outputs.tag}}" | cut -dv -f2)
echo "::set-output name=version::$version"
- name: Build Version
id: build
run: |
buildver=$(git describe --tags --match v* | cut -d- -f2)
echo "build = $buildver"
echo "::set-output name=buildver::$buildver"
changelog:
name: Generate Changelog (tags)
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Unshallow
run: git fetch --prune --unshallow
- name: Find Current Tag
id: current
uses: jimschubert/query-tag-action@v2
with:
include: 'v*'
exclude: '*-rc*'
commit-ish: '@'
skip-unshallow: 'true'
- name: Previous Tag
id: last
uses: jimschubert/query-tag-action@v2
with:
include: 'v*'
exclude: ${{steps.current.outputs.tag}}
skip-unshallow: 'true'
- name: Generate changelog
uses: jimschubert/beast-changelog-action@v1
with:
GITHUB_TOKEN: ${{github.token}}
CONFIG_LOCATION: .github/changelog.json
FROM: ${{steps.last.outputs.tag}}
TO: ${{steps.current.outputs.tag}}
OUTPUT: .github/CHANGELOG.md
- name: Read CHANGELOG file
id: getchangelog
run: echo "::set-output name=changelog::$(cat .github/CHANGELOG.md)"
- name: View Changelog
run: cat .github/CHANGELOG.md
- name: Add Artifact
uses: actions/upload-artifact@v4
with:
name: out
path: .github/CHANGELOG.md
jar:
name: Publish JAR
runs-on: ubuntu-20.04
needs: [vars, changelog]
steps:
- name: Download Changelog Results
uses: actions/download-artifact@v4
with:
name: out
path: changelog
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: "17"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Create datagen assets
run: ./gradlew runData
timeout-minutes: 15
env:
CM_RELEASE: true
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: ${{ needs.vars.outputs.build }}
- name: Test JAR with GameTest Server
run: ./gradlew runGameTestServer
timeout-minutes: 20
env:
CM_RELEASE: true
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: ${{ needs.vars.outputs.build }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload build failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-data
path: run/gametest
- name: Build JAR
run: ./gradlew build
timeout-minutes: 10
env:
CM_RELEASE: true
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: ${{ needs.vars.outputs.build }}
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Add Artifact
uses: actions/upload-artifact@v4
with:
name: libs
path: |
build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar
build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar
view:
name: View Changelog Output
runs-on: ubuntu-20.04
needs: [changelog]
steps:
- name: Download Build Results
uses: actions/download-artifact@v4
with:
name: out
path: changelog
- run: cat changelog/CHANGELOG.md
release-gh:
name: Make Github Release
runs-on: ubuntu-20.04
needs: [changelog, vars, jar]
steps:
- name: Download Build Results
uses: actions/download-artifact@v4
with:
name: libs
path: build-out
- name: Download Changelog Results
uses: actions/download-artifact@v4
with:
name: out
path: changelog
- name: Load Changelog File
id: changelog
run: echo ::set-output name=changelog::$(cat changelog/CHANGELOG.md)
- name: Create GitHub Release
uses: "marvinpinto/action-automatic-releases@latest"
with:
title: "Release ${{ needs.vars.outputs.version }}"
automatic_release_tag: "${{ needs.vars.outputs.version }}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
files: |
changelog/CHANGELOG.md
build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar
build/libs/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}-api.jar
release-cf:
name: Make Curseforge Release
runs-on: ubuntu-20.04
needs: [changelog, vars, jar]
steps:
- name: Download Build Results
uses: actions/download-artifact@v4
with:
name: libs
path: build-out
- name: Download Changelog Results
uses: actions/download-artifact@v4
with:
name: out
path: changelog
- name: Load Changelog File
id: changelog
run: echo ::set-output name=changelog::$(cat changelog/CHANGELOG.md)
- name: Full File
id: filename
run: echo "::set-output name=fullpath::build-out/${{ needs.vars.outputs.mod_id }}-${{ needs.vars.outputs.version }}.jar"
- name: Create CurseForge Release
uses: itsmeow/curseforge-upload@master
with:
token: ${{ secrets.CF_API_TOKEN }}
project_id: ${{ needs.vars.outputs.cf_project }}
game_endpoint: minecraft
file_path: ${{ steps.filename.outputs.fullpath }}
changelog: ${{ steps.changelog.outputs.changelog }}
changelog_type: markdown
game_versions: java:Java 17,Forge
release_type: ${{ needs.vars.outputs.release_type }}
publishMaven:
name: Maven Release (GH Packages)
runs-on: ubuntu-20.04
needs: [changelog, vars, jar]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: "17"
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Generate Resources
run: ./gradlew runData
- name: Publish gradle nightly jar
run: ./gradlew publishReleasePublicationToGitHubPackagesRepository
env:
CM_RELEASE: true
CM_SEMVER_VERSION: ${{ needs.vars.outputs.version }}
CM_BUILD_NUM: "0"
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}