@@ -84,30 +84,39 @@ jobs:
8484
8585 - uses : ./.github/actions/prepare-playground
8686
87- - name : Publish NPM packages
88- # Version bump, release, tag a new version on GitHub.
89- # On non-trunk branches, --no-push avoids pushing the version
90- # bump commit back to the branch. The published packages still
91- # get the version bump in their package.json on npm.
92- run : >
93- lerna publish ${{ inputs.version_bump || 'patch' }}
94- --yes --no-private --loglevel=verbose
95- --dist-tag=${{ inputs.dist_tag || 'latest' }}
96- ${{ github.ref != 'refs/heads/trunk' && '--no-push --no-git-tag-version' || '' }}
87+ - name : Bump version (trunk)
88+ # Bump all package versions and create a local git commit + tag,
89+ # but do not push yet — we amend the commit in the next step to
90+ # include the wasm-versions.json reset so both land as one commit.
91+ if : github.ref == 'refs/heads/trunk'
92+ run : lerna version ${{ inputs.version_bump || 'patch' }} --yes --no-push
9793
98- - name : Update wasm-versions.json to new stable version
94+ - name : Clear wasm-versions.json overrides and push (trunk)
95+ # wasm-versions.json may contain PR/SHA pre-release overrides from
96+ # the last WASM recompile. Reset it to {} so download-wasm.mjs
97+ # falls back to the lerna version for all packages.
9998 if : github.ref == 'refs/heads/trunk'
10099 run : |
101- node -e "
102- const fs = require('fs');
103- const versionsPath = 'packages/php-wasm/wasm-versions.json';
104- const newVersion = require('./lerna.json').version;
105- const versions = JSON.parse(fs.readFileSync(versionsPath, 'utf8'));
106- for (const key of Object.keys(versions)) {
107- versions[key] = newVersion;
108- }
109- fs.writeFileSync(versionsPath, JSON.stringify(versions, null, '\t') + '\n');
110- "
100+ echo '{}' > packages/php-wasm/wasm-versions.json
111101 git add packages/php-wasm/wasm-versions.json
112- git diff --staged --quiet || git commit -m "chore: update wasm-versions.json to $(node -e \"console.log(require('./lerna.json').version)\")"
113- git push origin trunk
102+ git commit --amend --no-edit
103+ NEW_VERSION=$(node -e "console.log(require('./lerna.json').version)")
104+ git tag -f "v${NEW_VERSION}"
105+ git push origin trunk --follow-tags
106+
107+ - name : Publish NPM packages (trunk)
108+ if : github.ref == 'refs/heads/trunk'
109+ run : >
110+ lerna publish from-git
111+ --yes --no-private --loglevel=verbose
112+ --dist-tag=${{ inputs.dist_tag || 'latest' }}
113+
114+ - name : Publish NPM packages (non-trunk)
115+ # On non-trunk branches no commit or tag is created — the version
116+ # bump only affects the published package.json on npm.
117+ if : github.ref != 'refs/heads/trunk'
118+ run : >
119+ lerna publish ${{ inputs.version_bump || 'patch' }}
120+ --yes --no-private --loglevel=verbose
121+ --dist-tag=${{ inputs.dist_tag || 'latest' }}
122+ --no-push --no-git-tag-version
0 commit comments