From 258c65f6d1fbfb9e0023c90c2e70c181ff9db75d Mon Sep 17 00:00:00 2001 From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com> Date: Sat, 15 Aug 2026 10:45:15 +1000 Subject: [PATCH] fix(release): apply CalVer in manifest mode The Release Please action ignores release-as in manifest mode. Keep the action for tag creation, but use the pinned Release Please CLI to update the manifest PR with the calculated CalVer override. Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com> --- .github/workflows/release-please.yml | 13 +++++++++---- mise.toml | 5 +++++ scripts/ci/release-pr.sh | 28 ++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+), 4 deletions(-) create mode 100755 scripts/ci/release-pr.sh diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 07ea576..b68ae31 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -20,15 +20,20 @@ jobs: install: false - id: calver run: mise run release:calver - - id: release - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 with: config-file: release-please-config.json manifest-file: .release-please-manifest.json - release-as: ${{ steps.calver.outputs.version }} + skip-github-pull-request: true target-branch: main + - id: release-pr + name: Update CalVer release PR + env: + CALVER_VERSION: ${{ steps.calver.outputs.version }} + GH_TOKEN: ${{ github.token }} + run: mise run release:pr - name: Approve release PR CI - if: ${{ steps.release.outputs.prs_created == 'true' }} + if: ${{ steps.release-pr.outputs.prs_created == 'true' }} env: GH_TOKEN: ${{ github.token }} run: mise run release:approve-ci diff --git a/mise.toml b/mise.toml index b8df723..a4afac9 100644 --- a/mise.toml +++ b/mise.toml @@ -27,6 +27,11 @@ file = "scripts/ci/detect-release.sh" description = "Calculate the next SemVer-compatible CalVer release" file = "scripts/ci/calver.sh" +[tasks."release:pr"] +description = "Create or update the CalVer Release Please PR" +tools = { "npm:release-please" = "17.6.1" } +file = "scripts/ci/release-pr.sh" + [tasks."release:approve-ci"] description = "Approve CI for the trusted Release Please PR" file = "scripts/ci/approve-release-ci.sh" diff --git a/scripts/ci/release-pr.sh b/scripts/ci/release-pr.sh new file mode 100755 index 0000000..d95f505 --- /dev/null +++ b/scripts/ci/release-pr.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +set -euo pipefail + +: "${CALVER_VERSION:?CALVER_VERSION is required}" +: "${GH_TOKEN:?GH_TOKEN is required}" +: "${GITHUB_OUTPUT:?GITHUB_OUTPUT is required}" +: "${GITHUB_REPOSITORY:?GITHUB_REPOSITORY is required}" + +branch="release-please--branches--main" +before_sha=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$branch" \ + --json headRefOid --jq '.[0].headRefOid // empty') + +release-please release-pr \ + --config-file release-please-config.json \ + --manifest-file .release-please-manifest.json \ + --release-as "$CALVER_VERSION" \ + --repo-url "$GITHUB_REPOSITORY" \ + --target-branch main \ + --token "$GH_TOKEN" + +after_sha=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$branch" \ + --json headRefOid --jq '.[0].headRefOid // empty') + +if [[ -n "$after_sha" && "$after_sha" != "$before_sha" ]]; then + echo "prs_created=true" >> "$GITHUB_OUTPUT" +else + echo "prs_created=false" >> "$GITHUB_OUTPUT" +fi