Files
zen/.github/workflows/release-please.yaml

87 lines
3.0 KiB
YAML

name: Release Please
# Single source of truth for STABLE version bumps + changelogs + tags.
#
# On every push to master it maintains one "Release PR" per component
# (separate-pull-requests). Merging a Release PR:
# * bumps the version(s) in the relevant Cargo.toml / package.json,
# * updates the CHANGELOG,
# * creates a git tag + GitHub Release for that component.
#
# The GitHub Release is what triggers the matching publish workflow
# (node.yaml / python.yaml / rust.yaml / uniffi.yaml) via its
# `on: release` trigger. We use a PAT (not GITHUB_TOKEN) so the created
# release is allowed to trigger those downstream workflows.
#
# Tags (include-component-in-tag + tag-separator "-"):
# core -> zen-engine-v<ver> (+ the 5 linked core crates), python -> python-v<ver>,
# nodejs -> nodejs-v<ver>, uniffi -> uniffi-v<ver>
#
# Betas use this SAME flow: during a prerelease window set `prerelease: true`
# + `prerelease-type: "beta"` on the components in release-please-config.json,
# and merges cut X.Y.Z-beta.N for every component (incl. uniffi). The publish
# workflows pick npm/dist-tag behaviour from `github.event.release.prerelease`.
# (One-time per-component `release-as: 1.0.0-beta.0` bootstraps the v1 base.)
on:
push:
branches:
- master
permissions:
contents: write
pull-requests: write
jobs:
release-please:
name: Release Please
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
- name: Install release-please
run: npm ci --prefix .github/release-please
- name: Run release-please
id: release
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
args=(
--token="$GH_TOKEN"
--repo-url="$GITHUB_REPOSITORY"
--target-branch=master
--config-file=release-please-config.json
--manifest-file=.release-please-manifest.json
--plugin="$PWD/.github/release-please/follow-leader.js"
)
bin=.github/release-please/node_modules/.bin/release-please
"$bin" github-release "${args[@]}"
"$bin" release-pr "${args[@]}"
branch=$(gh pr list --repo "$GITHUB_REPOSITORY" --base master --head release-please--branches--master --state open --json headRefName --jq '.[0].headRefName // ""')
echo "pr-branch=$branch" >> "$GITHUB_OUTPUT"
- uses: actions/checkout@v4
if: steps.release.outputs.pr-branch
with:
ref: ${{ steps.release.outputs.pr-branch }}
token: ${{ secrets.PAT }}
- uses: dtolnay/rust-toolchain@stable
if: steps.release.outputs.pr-branch
- name: Update Cargo.lock on release PR
if: steps.release.outputs.pr-branch
run: |
cargo update --workspace
git diff --quiet Cargo.lock && exit 0
git config user.name "Bot GoRules"
git config user.email "bot@gorules.io"
git add Cargo.lock
git commit -m "chore: update Cargo.lock for release"
git push