-
Notifications
You must be signed in to change notification settings - Fork 0
376 lines (324 loc) · 15.5 KB
/
Copy pathrelease.yml
File metadata and controls
376 lines (324 loc) · 15.5 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
name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
release_tag:
description: Tag to build and publish assets for
required: true
type: string
permissions:
contents: write
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
env:
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.release_tag }}
jobs:
validate:
name: Pre-release validation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.RELEASE_TAG }}
- uses: ./.github/actions/load-godot-toolchain
id: godot-config
- name: Download Godot
shell: bash
run: |
set -euo pipefail
mkdir -p .tools
curl -fsSL "${{ steps.godot-config.outputs.linux_url }}" -o /tmp/godot_linux.zip
printf '%s %s\n' "${{ steps.godot-config.outputs.linux_sha256 }}" /tmp/godot_linux.zip | shasum -a 256 -c -
unzip -oq /tmp/godot_linux.zip -d .tools/
chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64
- name: Run script tests
shell: bash
run: |
set -euo pipefail
./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --script res://tests/test_runner.gd > tests.log 2>&1
SCRIPT_EXIT=$?
cat tests.log
if [ $SCRIPT_EXIT -ne 0 ]; then
echo "::error::Script tests failed — aborting release"
exit 1
fi
- name: Run E2E gameplay flow tests
shell: bash
run: |
set -euo pipefail
./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --script res://tests/test_e2e.gd > e2e-tests.log 2>&1
E2E_EXIT=$?
cat e2e-tests.log
if [ $E2E_EXIT -ne 0 ]; then
echo "::error::E2E tests failed — aborting release"
exit 1
fi
- name: Run layout regression tests
shell: bash
run: |
set -euo pipefail
./.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --script res://tests/test_layout_math.gd > layout-tests.log 2>&1
LAYOUT_EXIT=$?
cat layout-tests.log
if [ $LAYOUT_EXIT -ne 0 ]; then
echo "::error::Layout regression tests failed — aborting release"
exit 1
fi
linux:
name: Linux export
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.RELEASE_TAG }}
- uses: ./.github/actions/load-godot-toolchain
id: godot-config
- name: Verify Python
shell: bash
run: |
set -euo pipefail
python3 --version
- name: Download Godot
shell: bash
run: |
set -euo pipefail
mkdir -p .tools
curl -fsSL "${{ steps.godot-config.outputs.linux_url }}" -o /tmp/godot_linux.zip
printf '%s %s\n' "${{ steps.godot-config.outputs.linux_sha256 }}" /tmp/godot_linux.zip | shasum -a 256 -c -
unzip -oq /tmp/godot_linux.zip -d .tools/
chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64
- name: Install export templates
shell: bash
run: |
set -euo pipefail
mkdir -p ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}
curl -fsSL "${{ steps.godot-config.outputs.templates_url }}" -o /tmp/godot_export_templates.tpz
printf '%s %s\n' "${{ steps.godot-config.outputs.templates_sha256 }}" /tmp/godot_export_templates.tpz | shasum -a 256 -c -
unzip -oq /tmp/godot_export_templates.tpz -d /tmp/godot_export_templates
cp -f /tmp/godot_export_templates/templates/* ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}/
- name: Export Linux build
shell: bash
run: |
set -euo pipefail
mkdir -p build/release/linux
.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --export-release "Linux/X11" ./build/release/linux/windowstead.x86_64
python3 - <<'PY'
from pathlib import Path
import zipfile
archive = Path("build/windowstead-linux.zip")
base = Path("build/release/linux")
with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as zf:
for relative in [Path("windowstead.x86_64"), Path("windowstead.pck")]:
zf.write(base / relative, relative.as_posix())
PY
- name: Upload release asset
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
with:
tag_name: ${{ env.RELEASE_TAG }}
files: build/windowstead-linux.zip
fail_on_unmatched_files: true
windows:
name: Windows export
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.RELEASE_TAG }}
- uses: ./.github/actions/load-godot-toolchain
id: godot-config
- name: Verify Python
shell: bash
run: |
set -euo pipefail
python3 --version
- name: Download Godot
shell: bash
run: |
set -euo pipefail
mkdir -p .tools
curl -fsSL "${{ steps.godot-config.outputs.linux_url }}" -o /tmp/godot_linux.zip
printf '%s %s\n' "${{ steps.godot-config.outputs.linux_sha256 }}" /tmp/godot_linux.zip | shasum -a 256 -c -
unzip -oq /tmp/godot_linux.zip -d .tools/
chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64
- name: Install export templates
shell: bash
run: |
set -euo pipefail
mkdir -p ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}
curl -fsSL "${{ steps.godot-config.outputs.templates_url }}" -o /tmp/godot_export_templates.tpz
printf '%s %s\n' "${{ steps.godot-config.outputs.templates_sha256 }}" /tmp/godot_export_templates.tpz | shasum -a 256 -c -
unzip -oq /tmp/godot_export_templates.tpz -d /tmp/godot_export_templates
cp -f /tmp/godot_export_templates/templates/* ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}/
- name: Export Windows build
shell: bash
run: |
set -euo pipefail
mkdir -p build/release/windows
.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --export-release "Windows Desktop" ./build/release/windows/windowstead.exe
python3 - <<'PY'
from pathlib import Path
import zipfile
archive = Path("build/windowstead-windows.zip")
base = Path("build/release/windows")
with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as zf:
for relative in [Path("windowstead.exe"), Path("windowstead.pck")]:
zf.write(base / relative, relative.as_posix())
PY
- name: Upload release asset
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
with:
tag_name: ${{ env.RELEASE_TAG }}
files: build/windowstead-windows.zip
fail_on_unmatched_files: true
macos:
name: macOS export
runs-on: macos-latest
needs: validate
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.RELEASE_TAG }}
- uses: ./.github/actions/load-godot-toolchain
id: godot-config
- name: Install Godot and export templates
shell: bash
run: |
set -euo pipefail
GODOT_TEMPLATES_DIR="$HOME/Library/Application Support/Godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}"
mkdir -p "$GODOT_TEMPLATES_DIR"
curl -fsSL "${{ steps.godot-config.outputs.templates_url }}" -o /tmp/godot_export_templates.tpz
printf '%s %s\n' "${{ steps.godot-config.outputs.templates_sha256 }}" /tmp/godot_export_templates.tpz | shasum -a 256 -c -
unzip -oq /tmp/godot_export_templates.tpz -d /tmp/godot_export_templates
cp -f /tmp/godot_export_templates/templates/* "$GODOT_TEMPLATES_DIR/"
mkdir -p .tools/macos
curl -fsSL "${{ steps.godot-config.outputs.macos_url }}" -o /tmp/godot_macos.zip
printf '%s %s\n' "${{ steps.godot-config.outputs.macos_sha256 }}" /tmp/godot_macos.zip | shasum -a 256 -c -
unzip -oq /tmp/godot_macos.zip -d .tools/macos
- name: Export macOS build
shell: bash
run: |
set -euo pipefail
mkdir -p build/release/macos
GODOT_MAC_APP=$(find .tools/macos -maxdepth 2 -name 'Godot.app' -print -quit)
if [ -z "$GODOT_MAC_APP" ]; then
echo 'Godot.app not found in downloaded macOS archive' >&2
exit 1
fi
# Inject release version into export_presets.cfg so the macOS bundle
# reports the correct CFBundleShortVersionString / CFBundleVersion.
sed -i \
-e "s/application\/short_version=\"0\.1\.0\"/application\/short_version=\"${{ github.ref_name }}\"/" \
-e "s/application\/version=\"0\.1\.0\"/application\/version=\"${{ github.ref_name }}\"/" \
export_presets.cfg
# Fail CI if the placeholders were absent — prevents future drift from
# silently shipping an untracked bundle version.
if grep -q 'application\/short_version="0.1.0"' export_presets.cfg || \
grep -q 'application\/version="0.1.0"' export_presets.cfg; then
echo 'ERROR: export_presets.cfg still contains 0.1.0 placeholders after sed replacement.' >&2
echo 'The preset file may have drifted; the macOS bundle version will be incorrect.' >&2
exit 1
fi
"$GODOT_MAC_APP/Contents/MacOS/Godot" --headless --path . --export-release "macOS" ./build/release/macos/windowstead.app
# Verify the exported bundle reports the correct version.
INFO_PLIST="build/release/macos/windowstead.app/Contents/Info.plist"
if [ ! -f "$INFO_PLIST" ]; then
echo "ERROR: Info.plist not found at $INFO_PLIST" >&2
exit 1
fi
BUNDLE_VERSION=$(python3 -c "import plistlib; print(plistlib.load(open('$INFO_PLIST','rb')).get('CFBundleShortVersionString',''))")
if [ "$BUNDLE_VERSION" != "${{ github.ref_name }}" ]; then
echo "ERROR: CFBundleShortVersionString is '$BUNDLE_VERSION', expected '${{ github.ref_name }}'" >&2
exit 1
fi
echo "macOS bundle version verified: $BUNDLE_VERSION"
python3 - <<'PY'
from pathlib import Path
import zipfile
archive = Path("build/windowstead-macos.zip")
base = Path("build/release/macos")
with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as zf:
pck_path = base / "windowstead.pck"
if pck_path.is_file():
zf.write(pck_path, pck_path.relative_to(base).as_posix())
app_root = base / "windowstead.app"
for path in app_root.rglob("*"):
if path.is_file():
zf.write(path, path.relative_to(base).as_posix())
PY
- name: Upload release asset
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
with:
tag_name: ${{ env.RELEASE_TAG }}
files: build/windowstead-macos.zip
fail_on_unmatched_files: true
web:
name: Web export
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
ref: ${{ env.RELEASE_TAG }}
- uses: ./.github/actions/load-godot-toolchain
id: godot-config
- name: Verify Python
shell: bash
run: |
set -euo pipefail
python3 --version
- name: Download Godot
shell: bash
run: |
set -euo pipefail
mkdir -p .tools
curl -fsSL "${{ steps.godot-config.outputs.linux_url }}" -o /tmp/godot_linux.zip
printf '%s %s\n' "${{ steps.godot-config.outputs.linux_sha256 }}" /tmp/godot_linux.zip | shasum -a 256 -c -
unzip -oq /tmp/godot_linux.zip -d .tools/
chmod +x .tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64
- name: Install export templates
shell: bash
run: |
set -euo pipefail
mkdir -p ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}
curl -fsSL "${{ steps.godot-config.outputs.templates_url }}" -o /tmp/godot_export_templates.tpz
printf '%s %s\n' "${{ steps.godot-config.outputs.templates_sha256 }}" /tmp/godot_export_templates.tpz | shasum -a 256 -c -
unzip -oq /tmp/godot_export_templates.tpz -d /tmp/godot_export_templates
cp -f /tmp/godot_export_templates/templates/* ~/.local/share/godot/export_templates/${{ steps.godot-config.outputs.version }}.${{ steps.godot-config.outputs.status }}/
- name: Export Web build
shell: bash
run: |
set -euo pipefail
mkdir -p build/release/web
.tools/Godot_v${{ steps.godot-config.outputs.version }}-${{ steps.godot-config.outputs.status }}_linux.x86_64 --headless --path . --export-release "Web" ./build/release/web/windowstead.html
python3 - <<'PY'
from pathlib import Path
import sys
base = Path("build/release/web")
expected = ["windowstead.html", "windowstead.pck", "windowstead.wasm", "windowstead.js"]
missing = [name for name in expected if not (base / name).is_file()]
if missing:
print(f"::error::Missing Web export artifact(s): {', '.join(missing)}", file=sys.stderr)
sys.exit(1)
PY
python3 - <<'PY'
from pathlib import Path
import zipfile
archive = Path("build/windowstead-web.zip")
base = Path("build/release/web")
expected = ["windowstead.html", "windowstead.pck", "windowstead.wasm", "windowstead.js"]
with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as zf:
for relative in expected:
zf.write(base / relative, relative)
PY
- name: Upload release asset
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3
with:
tag_name: ${{ env.RELEASE_TAG }}
files: build/windowstead-web.zip
fail_on_unmatched_files: true