Repository navigation
232 lines (203 loc) · 7.17 KB
/
Copy pathrelease.yml
File metadata and controls
232 lines (203 loc) · 7.17 KB
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
name: Release
# Tag 0.0.1 to publish a release, or 0.0.1-alpha / 0.0.1-beta for that channel. A leading v
# is also accepted. The version edit is made in the build checkout only, so the tag stays
# on the commit you tagged. After the upload, the action commits the next patch to main
# and moves the published notes under that version.
#
# Repository secrets: MODRINTH_TOKEN, CURSEFORGE_TOKEN.
# Repository variables: MODRINTH_PROJECT_ID, CURSEFORGE_PROJECT_ID.
# Tag a commit that is already on main. This file, on that commit, is what runs.
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-alpha"
- "[0-9]+.[0-9]+.[0-9]+-beta"
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-alpha"
- "v[0-9]+.[0-9]+.[0-9]+-beta"
permissions:
contents: read
concurrency:
group: release
cancel-in-progress: false
jobs:
notes:
name: Check the tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.meta.outputs.version }}
next: ${{ steps.meta.outputs.next }}
channel: ${{ steps.meta.outputs.channel }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- name: The tag is on main
run: |
set -euo pipefail
git fetch origin main
git merge-base --is-ancestor "$GITHUB_SHA" origin/main || {
echo "The tag is not on main. Tag a commit that is already on main."
exit 1
}
- name: Secrets and the changelog
id: meta
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_PROJECT_ID: ${{ vars.MODRINTH_PROJECT_ID }}
CURSEFORGE_PROJECT_ID: ${{ vars.CURSEFORGE_PROJECT_ID }}
run: |
set -euo pipefail
bash .github/scripts/release-publish.sh check-env
version=$(bash .github/scripts/release-version.sh parse "$GITHUB_REF_NAME")
channel=$(bash .github/scripts/release-version.sh channel "$GITHUB_REF_NAME")
next=$(bash .github/scripts/release-version.sh next "$version")
echo "version=${version}" >> "$GITHUB_OUTPUT"
echo "channel=${channel}" >> "$GITHUB_OUTPUT"
echo "next=${next}" >> "$GITHUB_OUTPUT"
bash .github/scripts/release-changelog.sh notes CHANGELOG.md "$version" > release-notes.md
- uses: actions/upload-artifact@v7
with:
name: release-notes
path: release-notes.md
mc-26-3:
name: Minecraft 26.3 (Fabric + NeoForge)
needs: notes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: |
21
25
- uses: gradle/actions/setup-gradle@v6
- name: Check the sources are committed with 26.3 active
run: |
./gradlew "Reset active project"
git diff --exit-code
- name: Check switching to 1.21.1 and back changes nothing
run: |
./gradlew "Set active project to 1.21.1"
./gradlew "Reset active project"
git diff --exit-code
- name: Check switching to 1.20.6 and back changes nothing
run: |
./gradlew "Set active project to 1.20.6"
./gradlew "Reset active project"
git diff --exit-code
- name: Set the published version
run: bash .github/scripts/release-version.sh write gradle.properties "${{ needs.notes.outputs.version }}"
- name: Unit tests and jars
run: ./gradlew :26.3:test :fabric:26.3:build :neoforge:26.3:build
- name: Collect jars
run: ./gradlew collectJars
- uses: actions/upload-artifact@v7
with:
name: jars-26.3
if-no-files-found: error
path: |
build/libs/*/primalpottery-fabric-26.3-*.jar
build/libs/*/primalpottery-neoforge-26.3-*.jar
!**/*-sources.jar
!**/*-javadoc.jar
!**/*-dev.jar
mc-1-20-6:
name: Minecraft 1.20.6 (NeoForge)
needs: notes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: |
21
25
- uses: gradle/actions/setup-gradle@v6
- name: Set the published version
run: bash .github/scripts/release-version.sh write gradle.properties "${{ needs.notes.outputs.version }}"
- name: Unit tests and jar
run: ./gradlew :1.20.6:test :neoforge:1.20.6:build
- uses: actions/upload-artifact@v7
with:
name: jars-1.20.6
if-no-files-found: error
path: |
neoforge/versions/1.20.6/build/libs/primalpottery-neoforge-1.20.6-*.jar
!**/*-sources.jar
!**/*-javadoc.jar
!**/*-dev.jar
mc-1-21-1:
name: Minecraft 1.21.1 (NeoForge)
needs: notes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-java@v6
with:
distribution: temurin
java-version: |
21
25
- uses: gradle/actions/setup-gradle@v6
- name: Set the published version
run: bash .github/scripts/release-version.sh write gradle.properties "${{ needs.notes.outputs.version }}"
- name: Unit tests and jar
run: ./gradlew :1.21.1:test :neoforge:1.21.1:build
- uses: actions/upload-artifact@v7
with:
name: jars-1.21.1
if-no-files-found: error
path: |
neoforge/versions/1.21.1/build/libs/primalpottery-neoforge-1.21.1-*.jar
!**/*-sources.jar
!**/*-javadoc.jar
!**/*-dev.jar
publish:
name: Publish
needs: [notes, mc-26-3, mc-1-20-6, mc-1-21-1]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v7
with:
name: release-notes
path: notes
- uses: actions/download-artifact@v7
with:
pattern: jars-*
path: jars
- name: Upload the release
env:
GH_TOKEN: ${{ github.token }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }}
MODRINTH_PROJECT_ID: ${{ vars.MODRINTH_PROJECT_ID }}
CURSEFORGE_PROJECT_ID: ${{ vars.CURSEFORGE_PROJECT_ID }}
RELEASE_TYPE: ${{ needs.notes.outputs.channel }}
TAG: ${{ github.ref_name }}
run: bash .github/scripts/release-publish.sh upload "${{ needs.notes.outputs.version }}" notes/release-notes.md jars
bump:
name: Next version
needs: [notes, publish]
if: needs.publish.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
fetch-tags: true
- name: Commit the next version to main
env:
VERSION: ${{ needs.notes.outputs.version }}
NEXT: ${{ needs.notes.outputs.next }}
TAG: ${{ github.ref_name }}
run: bash .github/scripts/release-commit.sh "$VERSION" "$NEXT" "$TAG"