diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c880f63..daa0f05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} \ No newline at end of file