@@ -5,7 +5,12 @@ name: Release app
55on :
66 workflow_dispatch :
77 push :
8- branches : [main, release/**]
8+ branches :
9+ - main
10+ - release/**
11+ - ' v*' # run on branches named like v0.0.6
12+ tags :
13+ - ' v*.*.*' # keep tag-based releases as well
914
1015jobs :
1116 build :
1419 contents : write
1520 strategy :
1621 matrix :
17- # Use the recommended minimum runner images to ensure compatibility:
18- # - ubuntu: ubuntu-22.04
19- # - windows: windows-2022
20- # - macOS: macos-13 (minimum supported macOS runner)
2122 os :
2223 - { name: "windows", image: "windows-2022" }
2324 - { name: "linux", image: "ubuntu-22.04" }
3738 node-version : 20
3839 cache : ' npm'
3940
40- # Ensure npm cache dir exists on Windows so actions/cache doesn't fail
4141 - name : Ensure npm cache directory exists (Windows)
4242 if : runner.os == 'Windows'
4343 run : |
5353 restore-keys : |
5454 ${{ runner.os }}-node-
5555
56- # CI-only cleanup to avoid npm optional deps corruption (runner-local only)
5756 - name : Clean up potential corrupted install (CI-only)
5857 run : |
5958 if [ "${{ runner.os }}" = "Windows" ]; then
60- echo "Removing node_modules and package-lock.json (runner-only)"
6159 powershell -Command "if (Test-Path node_modules) { Remove-Item -Recurse -Force node_modules } ; if (Test-Path package-lock.json) { Remove-Item -Force package-lock.json }"
6260 else
6361 rm -rf node_modules package-lock.json || true
@@ -71,25 +69,21 @@ jobs:
7169 else
7270 npm config set cache "${HOME}/.npm" --global
7371 fi
74- # Disable optional deps in CI to avoid failing native optional installs (workaround).
7572 npm config set optional false --global
7673 shell : bash
7774
7875 - name : Install dependencies (npm ci || npm install fallback)
7976 run : |
8077 set -e
81- echo "Attempting npm ci for reproducible install..."
8278 if [ "${{ runner.os }}" = "Windows" ]; then
8379 npm ci --no-audit --prefer-offline || (powershell -Command "if (Test-Path package-lock.json) { Remove-Item -Force package-lock.json }" ; npm install --no-audit --prefer-offline)
8480 else
8581 npm ci --no-audit --prefer-offline || (rm -f package-lock.json && npm install --no-audit --prefer-offline)
8682 fi
8783 shell : bash
8884
89- # Try platform-specific native rebuilds if present; non-fatal
9085 - name : Try rebuild rollup native binary (non-fatal)
9186 run : |
92- set -e || true
9387 if [[ "${{ matrix.os.name }}" == "linux" ]]; then
9488 npm rebuild @rollup/rollup-linux-x64-gnu || true
9589 elif [[ "${{ matrix.os.name }}" == "macos-intel" ]]; then
10498 - name : Build
10599 env :
106100 NODE_OPTIONS : " --max-old-space-size=4096"
107- run : |
108- npm run build
101+ run : npm run build
109102 shell : bash
110103
111104 - name : Publish app
@@ -129,34 +122,24 @@ jobs:
129122 set -e
130123 VERSION=$(node -e "console.log(require('./package.json').version)")
131124 TAG="v${VERSION}"
132- echo "Waiting for GitHub to register release ${TAG} assets..."
133125 attempts=0
134126 max=9
135127 sleep_interval=10
136128 while [ $attempts -lt $max ]; do
137- echo "Attempt $((attempts+1))/${max}..."
138129 resp=$(curl -s -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/releases/tags/${TAG}" || true)
139130 if echo "$resp" | grep -q "\"message\": \"Not Found\""; then
140131 echo "Release ${TAG} not found yet."
141132 else
142- echo "Release found; printing release summary:"
143133 echo "$resp" | jq -r '. | {name: .name, tag_name: .tag_name, draft: .draft, published_at: .published_at, html_url: .html_url, assets_count: .assets | length}'
144- echo "Assets list (name | size | url):"
145134 echo "$resp" | jq -r '.assets[] | "\(.name) | \(.size) | \(.browser_download_url)"' || true
146135 assets_count=$(echo "$resp" | jq '.assets | length')
147136 if [ "$assets_count" -gt 0 ]; then
148- echo "Assets are present (count=$assets_count)"
149137 break
150- else
151- echo "No assets yet; will retry."
152138 fi
153139 fi
154140 attempts=$((attempts+1))
155141 sleep $sleep_interval
156142 done
157- if [ $attempts -eq $max ]; then
158- echo "Warning: Assets did not appear within the expected time. The verify job may fail."
159- fi
160143 shell : bash
161144
162145 verify-assets :
@@ -180,7 +163,5 @@ jobs:
180163 - name : Verify all release assets are uploaded
181164 env :
182165 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
183- run : |
184- echo "Running release asset verification..."
185- node scripts/verify-release-assets.js
166+ run : node scripts/verify-release-assets.js
186167 shell : bash
0 commit comments