Repository navigation
381 lines (320 loc) · 12.9 KB
/
Copy pathbuild.yml
File metadata and controls
381 lines (320 loc) · 12.9 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
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: Build MudletInstaller
on:
push:
branches: [master, development]
tags:
- 'v*' # Add tag trigger for releases
pull_request:
workflow_dispatch:
jobs:
compile:
name: ${{matrix.buildname}}
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
buildname: 'Linux'
triplet: x64-linux
compiler: clang_64
qt: '6.9.1'
- os: macos-15
buildname: 'macOS'
triplet: arm64-osx
compiler: clang_64
qt: '6.9.1'
- os: windows-2025
buildname: 'Windows'
qt: '6.9.1'
steps:
- name: Checkout Source
uses: actions/checkout@v6
- name: (Linux, macOS) Install Qt
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: jurplel/install-qt-action@v4
with:
version: ${{matrix.qt}}
dir: ${{runner.workspace}}
cache: true
- name: (Linux, macOS) Use CMake 4.1.0
if: runner.os == 'Linux' || runner.os == 'macOS'
uses: lukka/get-cmake@v4.3.1
- name: (macOS) Install dependencies
if: runner.os == 'macOS'
env:
HOMEBREW_NO_ANALYTICS: "ON"
HOMEBREW_NO_AUTO_UPDATE: "ON"
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON"
HOMEBREW_NO_INSTALL_CLEANUP: "ON"
QT_VERSION: ${{ matrix.qt }}
run: |
# dependencies needed for vcpkg specifically.
BREWS=("automake" "autoconf" "pkg-config" "ccache")
# Loop through each brew package
for brew in "${BREWS[@]}"; do
if ! brew list --formula "${brew}" &>/dev/null; then
echo "Installing ${brew}..."
brew install "$brew"
else
echo "${brew} is already installed."
fi
done
# Set these here so that vcpkg can use them.
# Use latest available XCode
echo "DEVELOPER_DIR=$(xcode-select --print-path)" >> $GITHUB_ENV
echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> $GITHUB_ENV
echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV
- name: (Linux) Install dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ccache pkg-config
echo "CCACHE_DIR=${{runner.workspace}}/ccache" >> $GITHUB_ENV
- name: (Linux, macOS) Build Qt StateMachine Module
if: runner.os == 'Linux' || runner.os == 'macOS'
env:
QT_VERSION: ${{matrix.qt}}
run: |
# Make the build script executable and run it
chmod +x ./CI/build-qt-statemachine.sh
./CI/build-qt-statemachine.sh
- name: (Windows) Setup MSYS2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: CLANG64
update: true
- name: (Windows) Build Environment Setup
if: runner.os == 'Windows'
shell: msys2 {0}
run: |
$GITHUB_WORKSPACE/CI/setup-win-sdk.sh
echo "QT_ROOT=${{runner.workspace}}/qt-static-install" >> $GITHUB_ENV
- name: (Windows) Restore Qt cache
if: runner.os == 'Windows'
id: restore-qt
uses: actions/cache/restore@v5
with:
path: ${{env.QT_ROOT}}
key: qt-clang-${{env.QT_VERSION}}
- name: (Windows) Compile Qt
if: runner.os == 'Windows' && steps.restore-qt.outputs.cache-hit != 'true'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/compile-qt-win.sh
- name: (Windows) Save Qt cache
if: runner.os == 'Windows' && steps.restore-qt.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ${{env.QT_ROOT}}
key: ${{ steps.restore-qt.outputs.cache-primary-key }}
- name: Restore ccache
id: restore-ccache
uses: actions/cache/restore@v5
with:
path: ${{runner.workspace}}/ccache
key: ccache-${{matrix.os}}-${{matrix.buildname}}-${{ github.sha }}
restore-keys: ccache-${{matrix.os}}-${{matrix.buildname}}
- name: check ccache stats prior to build
if: runner.os == 'Linux' || runner.os == 'macOS'
run: ccache --zero-stats --show-stats
- name: (macOS, Linux) Build
if: runner.os == 'Linux' || runner.os == 'macOS'
env:
CMAKE_PREFIX_PATH: ${{ env.QT_PREFIX != '' && env.QT_PREFIX || env.MINGW_BASE_DIR }}
run: |
chmod +x $GITHUB_WORKSPACE/CI/build-mac-linux.sh
$GITHUB_WORKSPACE/CI/build-mac-linux.sh
- name: (Windows) Build
if: runner.os == 'Windows'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/build-win.sh
- name: Save ccache
if: always() && steps.restore-ccache.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ${{runner.workspace}}/ccache
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}
- name: check ccache stats post build
if: runner.os == 'Linux' || runner.os == 'macOS'
run: ccache --show-stats
- name: (Windows) Package
if: runner.os == 'Windows'
shell: msys2 {0}
run: $GITHUB_WORKSPACE/CI/package-win.sh
- name: (Windows) Login to Azure
uses: azure/login@v2
if: runner.os == 'Windows' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' && github.repository == 'Mudlet/bootstrap'
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Get Azure access token for code signing
shell: pwsh
if: runner.os == 'Windows' && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' && github.repository == 'Mudlet/bootstrap'
run: |
$token = (az account get-access-token --resource https://codesigning.azure.net | ConvertFrom-Json).accessToken
"::add-mask::$token"
"AZURE_ACCESS_TOKEN=$token" | Add-Content -Path $env:GITHUB_ENV
- name: (Windows) Deploy
if: runner.os == 'Windows'
shell: msys2 {0}
env:
AZURE_ACCESS_TOKEN: ${{ env.AZURE_ACCESS_TOKEN }}
run: $GITHUB_WORKSPACE/CI/deploy-win.sh
- name: (macOS) Prep for Artifact Upload
if: runner.os == 'macOS'
env:
BUILD_DIR: ${{runner.workspace}}/build
MACOS_SIGNING_PASS: ${{github.actor != 'dependabot[bot]' && secrets.MACOS_SIGNING_PASS || ''}}
APPLE_USERNAME: ${{secrets.APPLE_USERNAME}}
APPLE_PASSWORD: ${{secrets.APPLE_PASSWORD}}
APPLE_TEAM_ID: ${{secrets.APPLE_TEAM_ID}}
run: |
chmod +x $GITHUB_WORKSPACE/CI/package-mac.sh
$GITHUB_WORKSPACE/CI/package-mac.sh
- name: (Linux) Prep for Artifact Upload
if: runner.os == 'Linux'
env:
BUILD_DIR: ${{runner.workspace}}/build
run: |
chmod +x $GITHUB_WORKSPACE/CI/package-linux.sh
$GITHUB_WORKSPACE/CI/package-linux.sh
- name: Upload Packaged Product
uses: actions/upload-artifact@v6
if: env.UPLOAD_FILENAME
with:
name: ${{env.UPLOAD_FILENAME}}
path: ${{env.FOLDER_TO_UPLOAD}}
# A game added to GameList.txt has no launcher anywhere until a release is cut, so
# compare against the game list of the last release rather than the previous commit -
# that way a push whose release failed, or one that never triggered one, still gets picked up.
check-new-games:
runs-on: ubuntu-latest
outputs:
new-games: ${{steps.check.outputs.new-games}}
tag: ${{steps.check.outputs.tag}}
steps:
- name: Checkout Source
if: github.ref == 'refs/heads/development' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for games without a launcher
id: check
if: github.ref == 'refs/heads/development' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
run: |
latest_tag=$(git tag -l 'v*' --sort=-v:refname | head -1)
echo "Latest release tag: ${latest_tag:-none}"
# let a missing GameList.txt fail the job rather than release every game over again
: > released-games.txt
if [ -n "$latest_tag" ]; then
git show "$latest_tag:GameList.txt" > released-at-tag.txt
sort released-at-tag.txt > released-games.txt
fi
sort GameList.txt > current-games.txt
added=$(comm -13 released-games.txt current-games.txt)
if [ -z "$added" ]; then
echo "Every game already has a launcher in $latest_tag"
echo "new-games=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Games with no launcher yet:"
echo "$added"
# Bump the patch component, so v1.3.0 becomes v1.3.1
IFS=. read -r major minor patch <<< "${latest_tag#v}"
next_tag="v${major:-0}.${minor:-0}.$(( ${patch:-0} + 1 ))"
echo "Releasing as $next_tag"
echo "new-games=true" >> $GITHUB_OUTPUT
echo "tag=$next_tag" >> $GITHUB_OUTPUT
release:
if: startsWith(github.ref, 'refs/tags/') || needs.check-new-games.outputs.new-games == 'true'
needs: [compile, check-new-games]
runs-on: ubuntu-latest
permissions:
contents: write
env:
RELEASE_TAG: ${{startsWith(github.ref, 'refs/tags/') && github.ref_name || needs.check-new-games.outputs.tag}}
steps:
- name: Checkout Source (for GameList.txt)
uses: actions/checkout@v6
- name: Download all platform artifacts
uses: actions/download-artifact@v7
with:
path: ./platform-artifacts
- name: Organize launchers by game
run: |
chmod +x $GITHUB_WORKSPACE/CI/organize-launchers.sh
$GITHUB_WORKSPACE/CI/organize-launchers.sh
- name: Generate release body
run: |
echo "=== Generating release body ==="
# Get repository and tag info
REPO="${{ github.repository }}"
TAG="$RELEASE_TAG"
BASE_URL="https://github.com/$REPO/releases/download/$TAG"
echo "Base URL: $BASE_URL"
# Start building the release body
cat > release-body.md << 'EOF'
## MudletInstaller Release ${{ env.RELEASE_TAG }}
Choose your game below and download the appropriate file for your operating system:
EOF
# Add each game as a section
if [ -d "organized-releases" ]; then
for game_dir in organized-releases/*/; do
if [ -d "$game_dir" ]; then
game_name=$(basename "$game_dir")
echo "### $game_name" >> release-body.md
echo "" >> release-body.md
# Check for each platform
windows_file=$(find "$game_dir" -name "*Windows.exe" | head -1)
macos_file=$(find "$game_dir" -name "*macOS.dmg" | head -1)
linux_file=$(find "$game_dir" -name "*Linux.AppImage.tar" | head -1)
if [ -n "$windows_file" ]; then
filename=$(basename "$windows_file")
echo "- **Windows**: [\`$filename\`]($BASE_URL/$filename)" >> release-body.md
fi
if [ -n "$macos_file" ]; then
filename=$(basename "$macos_file")
echo "- **macOS**: [\`$filename\`]($BASE_URL/$filename)" >> release-body.md
fi
if [ -n "$linux_file" ]; then
filename=$(basename "$linux_file")
echo "- **Linux**: [\`$filename\`]($BASE_URL/$filename)" >> release-body.md
fi
echo "" >> release-body.md
fi
done
fi
# Add installation instructions
cat >> release-body.md << 'EOF'
## Installation Instructions
### Windows
1. Download the `.exe` file for your game
2. Run MudletInstaller - it'll download & install Mudlet for you
3. You can delete MudletInstaller after - Mudlet is all set up to play your favourite game.
### macOS
1. Download the `.dmg` file for your game
2. Open the DMG file
3. Run the MudletInstaller app from within the mounted DMG
### Linux
1. Download the `.AppImage.tar` file for your game
2. Extract it: `tar -xf MudletInstaller-[game]-Linux.AppImage.tar`
2. Extract and run the AppImage within: `MudletInstaller-[game].AppImage`
3. You can delete MudletInstaller after - Mudlet is all set up to play your favourite
EOF
echo "Generated release body:"
cat release-body.md
- name: Create Release with Game Organization
uses: softprops/action-gh-release@v2
with:
files: organized-releases/**/*
tag_name: ${{ env.RELEASE_TAG }}
# without this the tag lands on whatever development's tip happens to be by now,
# which may be ahead of the commit these launchers were built from
target_commitish: ${{ github.sha }}
name: MudletInstaller ${{ env.RELEASE_TAG }}
body_path: release-body.md
draft: false
prerelease: false
generate_release_notes: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}