Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
28 changes: 28 additions & 0 deletions scripts/ci/release-pr.sh
Original file line number Diff line number Diff line change
@@ -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