Repository navigation
84 lines (75 loc) · 2.92 KB
/
Copy pathrelease.yml
File metadata and controls
84 lines (75 loc) · 2.92 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
name: Release
# Fires when a GitHub Release is published (Releases > Draft a new release > Publish).
# Builds the NUI fresh and attaches a lean, drop-in resource zip to that release.
on:
release:
types: [published]
# Re-package an already published release without unpublishing it, for when the
# packaging itself was wrong rather than the code.
workflow_dispatch:
inputs:
tag:
description: 'Existing tag to package (e.g. v0.9.6)'
required: true
permissions:
contents: write
jobs:
package:
name: build + package
runs-on: ubuntu-latest
env:
TAG: ${{ github.event.release.tag_name || inputs.tag }}
steps:
- uses: actions/checkout@v7
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
cache-dependency-path: web/package-lock.json
- name: Build NUI
working-directory: web
run: |
npm ci
npm run build
# Explicit allowlist of runtime files -> dist/sd-phone/ so the zip extracts
# to a correctly named resource folder. web/src, node_modules, dev configs
# and the root screenshot PNGs are intentionally left out.
- name: Stage resource
run: |
mkdir -p dist/sd-phone/web
cp fxmanifest.lua README.md dist/sd-phone/
cp -r bridge client server shared configs locales images media-server dist/sd-phone/
cp -r web/build dist/sd-phone/web/build
# The staging list above is an allowlist, so a new top-level directory is
# dropped from the zip in silence: v0.9.6 shipped without shared/ and every
# `require 'shared.*'` failed on start. Fail the build instead.
- name: Verify staged resource
run: |
missing=0
paths=$(grep -oE "'[^']+\.(lua|json|html|js|css|png|jpg|webp|svg|woff2?|mp3)'" fxmanifest.lua \
| tr -d "'" | grep -v '^@' | sed 's|/\*\*.*||; s|/\*.*||' | sort -u)
for p in $paths; do
if [ ! -e "dist/sd-phone/$p" ]; then
echo "::error::fxmanifest.lua declares '$p' but it is not in the staged resource"
missing=1
fi
done
if [ "$missing" != 0 ]; then
echo "Staged resource is incomplete - add the missing path to the Stage resource step."
exit 1
fi
echo "All fxmanifest paths present:"
echo "$paths"
# Named without the tag so the download URL and the extracted folder read the
# same on every release, and a linked install guide never points at a stale
# filename. The release itself carries the version.
- name: Zip
run: |
cd dist
zip -qr ../sd-phone.zip sd-phone
- name: Attach to release
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${TAG}" sd-phone.zip --clobber