-
Notifications
You must be signed in to change notification settings - Fork 0
247 lines (218 loc) · 9.4 KB
/
Copy pathrelease.yml
File metadata and controls
247 lines (218 loc) · 9.4 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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# Release pipeline for the Komm client.
#
# Release flow (create a GitHub release with tag e.g. 0.0.3):
# 1. jar — sets the Maven version from the release tag (the tag is the
# single source of truth; app.properties' client.version is
# filtered from it; a leading "v" is tolerated and stripped),
# builds the fat jar and attaches it to the release. Nothing
# further to deploy — the launcher fetches this jar straight
# from the release (releases/latest via GitHub's API), verified
# against the SHA-256 digest GitHub reports for the asset.
# 2. installer / appimage — check out komm-launcher@main, bundle the exact
# jar built in step 1 as the seed, and attach the resulting
# Komm-Setup-<v>.exe / Komm-<v>-x86_64.AppImage to the SAME
# release. Stable-named aliases (Komm-Setup.exe, Komm.AppImage)
# are uploaded too so `releases/latest/download/...` links stay
# stable across versions.
#
# Manual flow (Actions tab -> Run workflow, tag = existing release e.g. 0.0.3):
# Skips the jar build; rebuilds only the installers from the CURRENT
# komm-launcher main against that release's already-published jar and
# replaces the installer assets on it. Use this after launcher-only changes.
#
# Secrets:
# LAUNCHER_REPO_TOKEN (optional) — only needed if komm-launcher is private.
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Existing release tag (e.g. 0.0.3) — rebuilds only the exe/AppImage from current launcher main and replaces them on that release"
required: true
permissions:
contents: write
env:
LAUNCHER_REPO: B077AS/komm-launcher
jobs:
jar:
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Resolve version from release tag
id: v
env:
TAG: ${{ github.event.release.tag_name }}
run: |
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Build fat jar (version from tag)
run: |
mvn -B versions:set -DnewVersion="${{ steps.v.outputs.version }}" -DgenerateBackupPoms=false
mvn -B clean package -Ppackage,prod
# Hands the exact released jar to the installer jobs of this run.
- uses: actions/upload-artifact@v4
with:
name: client-jar
path: target/komm-${{ steps.v.outputs.version }}.jar
if-no-files-found: error
- name: Attach jar to the release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload "${{ steps.v.outputs.tag }}" \
"target/komm-${{ steps.v.outputs.version }}.jar" \
--clobber -R "$GITHUB_REPOSITORY"
installer:
name: Windows installer
needs: jar
# Runs after a successful jar build (release flow) or standalone when the jar
# job was skipped (manual installers-only flow).
if: ${{ !cancelled() && (needs.jar.result == 'success' || needs.jar.result == 'skipped') }}
runs-on: windows-latest
defaults:
run:
shell: bash
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Resolve launcher release tag
id: launcher-v
run: |
TAG=$(gh release view --repo B077AS/komm-launcher --json tagName -q .tagName)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
# Pinned to the launcher's own latest release (not a moving `main` HEAD) so
# every installer/AppImage build is reproducible and bundles a launcher jar
# that's already correctly self-versioned (see the version-set step below).
- name: Check out komm-launcher (latest release)
uses: actions/checkout@v4
with:
repository: B077AS/komm-launcher
ref: ${{ steps.launcher-v.outputs.tag }}
token: ${{ secrets.LAUNCHER_REPO_TOKEN || github.token }}
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Set launcher Maven version from its release tag
run: mvn -B versions:set -DnewVersion="${{ steps.launcher-v.outputs.version }}" -DgenerateBackupPoms=false
- name: Resolve version
id: v
run: |
if [ "${{ github.event_name }}" = "release" ]; then
TAG="${{ github.event.release.tag_name }}"
else
TAG="${{ inputs.tag }}"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Get client jar (from this run)
if: github.event_name == 'release'
uses: actions/download-artifact@v4
with:
name: client-jar
path: client-jar
- name: Get client jar (from existing release)
if: github.event_name == 'workflow_dispatch'
run: |
gh release download "${{ steps.v.outputs.tag }}" \
--pattern "komm-${{ steps.v.outputs.version }}.jar" \
--dir client-jar -R "$GITHUB_REPOSITORY"
- name: Build installer
run: |
echo "Building installers from komm-launcher@$(git rev-parse HEAD)"
mvn -B clean package -Pinstaller \
"-Dclient.version=${{ steps.v.outputs.version }}" \
"-Dclient.jar=${{ github.workspace }}\client-jar\komm-${{ steps.v.outputs.version }}.jar" \
"-Discc.path=C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
- name: Upload installer to the client release
run: |
V="${{ steps.v.outputs.version }}"
# Stable alias so the hub site's releases/latest/download link never changes.
cp "target/installer/Komm-Setup-$V.exe" "target/installer/Komm-Setup.exe"
gh release upload "${{ steps.v.outputs.tag }}" \
"target/installer/Komm-Setup-$V.exe" \
"target/installer/Komm-Setup.exe" \
--clobber -R "$GITHUB_REPOSITORY"
appimage:
name: Linux AppImage
needs: jar
if: ${{ !cancelled() && (needs.jar.result == 'success' || needs.jar.result == 'skipped') }}
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Resolve launcher release tag
id: launcher-v
run: |
TAG=$(gh release view --repo B077AS/komm-launcher --json tagName -q .tagName)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
# Pinned to the launcher's own latest release (not a moving `main` HEAD) so
# every installer/AppImage build is reproducible and bundles a launcher jar
# that's already correctly self-versioned (see the version-set step below).
- name: Check out komm-launcher (latest release)
uses: actions/checkout@v4
with:
repository: B077AS/komm-launcher
ref: ${{ steps.launcher-v.outputs.tag }}
token: ${{ secrets.LAUNCHER_REPO_TOKEN || github.token }}
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
cache: maven
- name: Set launcher Maven version from its release tag
run: mvn -B versions:set -DnewVersion="${{ steps.launcher-v.outputs.version }}" -DgenerateBackupPoms=false
- name: Resolve version
id: v
run: |
if [ "${{ github.event_name }}" = "release" ]; then
TAG="${{ github.event.release.tag_name }}"
else
TAG="${{ inputs.tag }}"
fi
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"
- name: Get client jar (from this run)
if: github.event_name == 'release'
uses: actions/download-artifact@v4
with:
name: client-jar
path: client-jar
- name: Get client jar (from existing release)
if: github.event_name == 'workflow_dispatch'
run: |
gh release download "${{ steps.v.outputs.tag }}" \
--pattern "komm-${{ steps.v.outputs.version }}.jar" \
--dir client-jar -R "$GITHUB_REPOSITORY"
- name: Install appimagetool
run: |
mkdir -p ~/.local/bin
curl -Lo ~/.local/bin/appimagetool \
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x ~/.local/bin/appimagetool
- name: Build AppImage
run: |
echo "Building installers from komm-launcher@$(git rev-parse HEAD)"
mvn -B clean package -Pappimage \
"-Dclient.version=${{ steps.v.outputs.version }}" \
"-Dclient.jar=$GITHUB_WORKSPACE/client-jar/komm-${{ steps.v.outputs.version }}.jar"
- name: Upload AppImage to the client release
run: |
V="${{ steps.v.outputs.version }}"
# Stable alias so the hub site's releases/latest/download link never changes.
cp "target/appimage/Komm-$V-x86_64.AppImage" "target/appimage/Komm.AppImage"
gh release upload "${{ steps.v.outputs.tag }}" \
"target/appimage/Komm-$V-x86_64.AppImage" \
"target/appimage/Komm.AppImage" \
--clobber -R "$GITHUB_REPOSITORY"