fix: include release version in PR title and commit name

changesets/action@v1 does not output a `version` field, so the
`|| 'Next'` fallback always fired producing "Release Next".

Replaced the naive get-version step with one that runs
`changeset status --output` to resolve the next bumped version
before the changesets action runs. Falls back to the current
package.json version on publish runs (where the release PR has
already bumped the version).
This commit is contained in:
Kacper Kula 2026-03-22 22:50:41 +00:00
parent bf24096d75
commit 4ea9a1ea34

View file

@ -23,19 +23,26 @@ jobs:
with:
node-version: 18.x
cache: "pnpm"
- name: Get current version
id: get-version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- run: pnpm install --frozen-lockfile
- run: pnpm build
- name: Get release version
id: get-version
run: |
# If changesets are pending, get the next bumped version from them.
# If no changesets (publish run), the release PR already bumped package.json.
if pnpm changeset status --output=.changeset/status.json 2>/dev/null; then
NEXT=$(node -e "try { const s = require('./.changeset/status.json'); console.log(s.releases[0].newVersion) } catch(e) { console.log('') }")
fi
CURRENT=$(node -p "require('./package.json').version")
echo "version=${NEXT:-$CURRENT}" >> $GITHUB_OUTPUT
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run ci:publish
version: pnpm run ci:version
title: "[Release] ${{ steps.changesets.outputs.version || 'Next' }}"
commit: "release: Release ${{ steps.changesets.outputs.version || 'Next' }}"
title: "release: Release ${{ steps.get-version.outputs.version }}"
commit: "release: Release ${{ steps.get-version.outputs.version }}"
createGithubReleases: false # this is handled inside ci:publish script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}