Skip to content

Commit 885963f

Browse files
ci: fix runtime publish (tag/Node), commit regenerated runtime back, auto-commit sponsor image (#5647)
* ci(npm): publish prerelease as latest + bump CI Node to 22 The OIDC migration (#5646) authenticates correctly but `npm publish` fails on npm >= 11 with 'You must specify a tag using --tag when publishing a prerelease version' — the old JS-DevTools action defaulted to `latest` implicitly. v3 intentionally ships alpha.N as the default dist-tag (the templates pin "@wailsio/runtime": "latest"), so publish with --tag latest. Also bump the CI Node from the deprecated 20 to 22 (LTS). * ci(npm): verify generated artifacts + commit regenerated runtime to master Harden the publish flow per the existing regenerate-before-publish design: - add a Verify step that fails the job if (re)generation didn't produce the expected outputs (bundled runtime + npm dist/), catching silent build failures before anything is published or committed. - make the commit-back explicit: 'git add -A' sweeps every regenerated tracked file (bundled runtime in internal/assetserver/bundledassets, generated pkg/events/events.go, TypeDoc output) back to master alongside the version bump; log 'git status' so the committed set is visible. dist/ is gitignored and is rebuilt fresh by prepack at publish time. * ci(sponsors): auto-commit sponsor image instead of opening a PR Push the regenerated website/static/img/sponsors.svg straight to master (no-op when unchanged) using the bypass-capable WAILS_REPO_TOKEN, matching publish-npm.yml, rather than opening a daily 'update sponsors' PR. Also modernise the actions (checkout v3->v4, setup-node v2->v4, Node 20->22). --------- Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
1 parent 4a31edc commit 885963f

2 files changed

Lines changed: 56 additions & 22 deletions

File tree

.github/workflows/generate-sponsor-image.yml

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,34 @@ jobs:
1010
name: Update Sponsors
1111
runs-on: ubuntu-latest
1212
if: github.repository == 'wailsapp/wails'
13+
permissions:
14+
contents: write
1315
steps:
14-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
17+
with:
18+
# Use the bypass-capable token so the auto-commit can push directly
19+
# to the protected master branch (same pattern as publish-npm.yml).
20+
token: ${{ secrets.WAILS_REPO_TOKEN || github.token }}
1521

1622
- name: Set Node
17-
uses: actions/setup-node@v2
23+
uses: actions/setup-node@v4
1824
with:
19-
node-version: 20.x
25+
node-version: "22"
2026

2127
- name: Update Sponsors
2228
run: cd scripts/sponsors && chmod 755 ./generate-sponsor-image.sh && ./generate-sponsor-image.sh
2329
env:
2430
SPONSORKIT_GITHUB_TOKEN: ${{ secrets.SPONSORS_TOKEN }}
2531
SPONSORKIT_GITHUB_LOGIN: wailsapp
2632

27-
- name: Create Pull Request
28-
uses: peter-evans/create-pull-request@v6
29-
with:
30-
commit-message: "chore: update sponsors.svg"
31-
add-paths: "website/static/img/sponsors.svg"
32-
title: "chore: update sponsors.svg"
33-
body: |
34-
Auto-generated by the sponsor image workflow
35-
36-
[skip ci] [skip actions]
37-
branch: update-sponsors
38-
base: master
39-
delete-branch: true
40-
draft: false
33+
- name: Commit updated sponsor image
34+
run: |
35+
git config user.name "github-actions[bot]"
36+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
37+
if git diff --quiet -- website/static/img/sponsors.svg; then
38+
echo "No sponsor changes to commit."
39+
exit 0
40+
fi
41+
git add website/static/img/sponsors.svg
42+
git commit -m "chore: update sponsors.svg [skip ci]"
43+
git push

.github/workflows/publish-npm.yml

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ jobs:
7878
version: 3.x
7979
repo-token: ${{ secrets.GITHUB_TOKEN }}
8080

81-
- name: Use Node.js 20
81+
- name: Use Node.js 22
8282
uses: actions/setup-node@v4
8383
with:
84-
node-version: "20"
84+
node-version: "22"
8585

8686
- name: Upgrade npm for Trusted Publishing
8787
# Trusted Publishing (OIDC) requires npm >= 11.5.1.
@@ -109,15 +109,43 @@ jobs:
109109
npm test
110110
npm run build
111111
112+
- name: Verify generated artifacts
113+
# Fail the publish if (re)generation did not produce the expected
114+
# outputs — both the npm package payload (dist/, gitignored, what gets
115+
# published) and the tracked bundled runtime that is committed back to
116+
# master below. A missing/empty file here means a silent build failure.
117+
working-directory: v3
118+
run: |
119+
set -euo pipefail
120+
required=(
121+
"internal/assetserver/bundledassets/runtime.js"
122+
"internal/assetserver/bundledassets/runtime.debug.js"
123+
"internal/runtime/desktop/@wailsio/runtime/dist/runtime.js"
124+
)
125+
for f in "${required[@]}"; do
126+
if [ ! -s "$f" ]; then
127+
echo "::error::expected generated artifact missing or empty: v3/$f"
128+
exit 1
129+
fi
130+
done
131+
echo "All expected runtime artifacts were generated."
132+
112133
- name: Bump version
113134
id: bump-version
114135
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
115136
run: |
116137
echo "version=$(npm --no-git-tag-version --force version prerelease)" >> "$GITHUB_OUTPUT"
117138
118-
- name: Commit changes
139+
- name: Commit regenerated runtime + version bump
140+
# Commit ALL regenerated tracked files back to master, not just the
141+
# version bump: the bundled runtime (internal/assetserver/bundledassets),
142+
# generated events (v3/pkg/events/events.go) and TypeDoc output all come
143+
# from `task runtime:build` and must stay in sync with the published
144+
# package. dist/ is gitignored, so `git add -A` will not commit it.
119145
run: |
120-
git add .
146+
git add -A
147+
echo "Files committed back to master:"
148+
git status --short
121149
git commit -m "[skip ci] Publish @wailsio/runtime ${{ steps.bump-version.outputs.version }}"
122150
git push
123151
@@ -127,4 +155,7 @@ jobs:
127155
# Requires a Trusted Publisher to be configured for @wailsio/runtime on
128156
# npmjs.com (repo: wailsapp/wails, workflow: publish-npm.yml).
129157
working-directory: v3/internal/runtime/desktop/@wailsio/runtime
130-
run: npm publish --access public
158+
# --tag latest: v3 ships prerelease (alpha.N) as the default dist-tag,
159+
# matching the templates' "@wailsio/runtime": "latest" pin. npm >= 11
160+
# requires an explicit --tag to publish a prerelease as latest.
161+
run: npm publish --access public --tag latest

0 commit comments

Comments
 (0)