-
Notifications
You must be signed in to change notification settings - Fork 7
238 lines (211 loc) · 7.54 KB
/
Copy pathlauncher-release.yml
File metadata and controls
238 lines (211 loc) · 7.54 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
name: Launcher Release
on:
push:
branches: [main, develop]
paths:
- 'launcher/**'
workflow_dispatch:
inputs:
version:
description: Optional numeric launcher version (otherwise generated from the run number)
required: false
type: string
concurrency:
group: launcher-release-${{ github.ref }}
cancel-in-progress: false
permissions:
contents: write
jobs:
detect-changes:
name: Detect Launcher Changes
if: github.repository == 'Modtale/modtale' && github.event.deleted != true
runs-on: ubuntu-latest
outputs:
launcher_build: ${{ steps.filter.outputs.launcher_build }}
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect changed components
id: filter
if: github.event_name == 'push'
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
run: bash .github/scripts/detect-component-changes.sh
metadata:
name: Resolve Release Metadata
needs: detect-changes
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.launcher_build == 'true'
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.version.outputs.tag }}
version: ${{ steps.version.outputs.version }}
channel: ${{ steps.version.outputs.channel }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Resolve launcher version and channel
id: version
env:
INPUT_VERSION: ${{ inputs.version }}
run: bash .github/scripts/launcher-release-metadata.sh
package:
name: Package Launcher (${{ matrix.name }})
needs: metadata
if: github.repository == 'Modtale/modtale'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Linux Packages
os: ubuntu-latest
artifact: launcher-linux
- name: Windows Installer
os: windows-latest
artifact: launcher-windows
- name: macOS DMG
os: macos-latest
artifact: launcher-macos
defaults:
run:
working-directory: launcher
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Set up Linux packaging tooling
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
binutils \
flatpak \
rpm \
tar \
xz-utils \
zstd
sudo apt-get install -y libfuse2 || sudo apt-get install -y libfuse2t64 || true
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
sudo flatpak install -y flathub org.freedesktop.Platform//25.08 org.freedesktop.Sdk//25.08
curl -L \
-o "$RUNNER_TEMP/appimagetool" \
https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x "$RUNNER_TEMP/appimagetool"
echo "APPIMAGETOOL=$RUNNER_TEMP/appimagetool" >> "$GITHUB_ENV"
echo "APPIMAGE_EXTRACT_AND_RUN=1" >> "$GITHUB_ENV"
- name: Set up Windows installer tooling
if: runner.os == 'Windows'
shell: pwsh
run: |
choco install wixtoolset -y --no-progress
$wix = Get-ChildItem "C:\Program Files (x86)" -Directory -Filter "WiX Toolset*" |
Sort-Object Name -Descending |
Select-Object -First 1
if ($null -eq $wix) {
throw "WiX Toolset was not installed."
}
"$($wix.FullName)\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
- name: Ensure Gradle wrapper is executable
run: chmod +x gradlew
- name: Build native launcher package
run: |
package_task="packageAll"
if [ "$RUNNER_OS" = "Linux" ]; then
package_task="packageLinuxAll"
fi
./gradlew clean "$package_task" -PlauncherVersion="${{ needs.metadata.outputs.version }}"
- name: Upload Linux AppImage package
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: launcher-linux-appimage
path: launcher/build/distributions/*.AppImage
if-no-files-found: error
- name: Upload Linux Debian package
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: launcher-linux-deb
path: launcher/build/distributions/*.deb
if-no-files-found: error
- name: Upload Linux RPM package
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: launcher-linux-rpm
path: launcher/build/distributions/*.rpm
if-no-files-found: error
- name: Upload Linux Flatpak package
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: launcher-linux-flatpak
path: launcher/build/distributions/*.flatpak
if-no-files-found: error
- name: Upload Linux pacman package
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: launcher-linux-pacman
path: launcher/build/distributions/*.pkg.tar.zst
if-no-files-found: error
- name: Upload launcher package
if: runner.os != 'Linux'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: launcher/build/distributions/*
if-no-files-found: error
publish:
name: Publish Launcher Release
needs:
- metadata
- package
if: github.repository == 'Modtale/modtale'
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ needs.metadata.outputs.tag }}
LAUNCHER_VERSION: ${{ needs.metadata.outputs.version }}
RELEASE_CHANNEL: ${{ needs.metadata.outputs.channel }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Download packaged launchers
uses: actions/download-artifact@v4
with:
path: launcher-dist
- name: Create checksums
run: |
find launcher-dist -type f -print0 | sort -z | xargs -0 sha256sum > SHA256SUMS
- name: Publish GitHub release
run: |
if gh release view "$RELEASE_TAG" >/dev/null 2>&1; then
if [ "$(gh release view "$RELEASE_TAG" --json isDraft --jq .isDraft)" != true ]; then
echo "::error::Release $RELEASE_TAG is already published; choose a new version."
exit 1
fi
else
gh release create "$RELEASE_TAG" \
--target "$GITHUB_SHA" \
--title "Modtale Launcher $LAUNCHER_VERSION ($RELEASE_CHANNEL)" \
--draft \
--generate-notes
fi
mapfile -d '' release_files < <(find launcher-dist -type f -print0)
gh release upload "$RELEASE_TAG" "${release_files[@]}" SHA256SUMS --clobber
if [ "$RELEASE_CHANNEL" = develop ]; then
gh release edit "$RELEASE_TAG" --draft=false --prerelease --latest=false
else
gh release edit "$RELEASE_TAG" --draft=false --prerelease=false --latest
fi