From a768189e40e4f5897b2b1ca4bf405d77b98bc67d Mon Sep 17 00:00:00 2001 From: Vincent Taverna Date: Sat, 4 Jul 2026 19:10:59 -0400 Subject: [PATCH] ci: move release flow to the knot; open version PR on Tangled MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The knot is the source of truth and GitHub is a one-way force mirror, so the GitHub-side changesets 'Version Packages' PR could never reach the knot and would be clobbered by the next mirror push. Drop .github/workflows/version.yml and drive releases from the knot: 'just version-pr' pushes a branch that opens the review PR on Tangled, and 'just release' tags main after merge — the tag mirrors to GitHub where release.yml publishes. --- .github/workflows/release.yml | 6 ++-- .github/workflows/version.yml | 59 ----------------------------------- justfile | 38 ++++++++++++++++++++++ 3 files changed, 41 insertions(+), 62 deletions(-) delete mode 100644 .github/workflows/version.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f12eb7a..3d9cfe1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,8 @@ name: Release -# Triggered by a v* tag (pushed by the auto-tag job in version.yml after a -# changesets version PR is merged). Builds all platform binaries in parallel, -# then publishes the per-platform npm packages, root package, and Docker image. +# Triggered by a v* tag cut on the knot with `just release` (after the version +# PR merges) and mirrored here. Builds all platform binaries in parallel, then +# publishes the per-platform npm packages, root package, and Docker image. on: push: diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml deleted file mode 100644 index 38a8f08..0000000 --- a/.github/workflows/version.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Version - -# Manages the changesets release cycle: -# - While changesets are pending: opens/updates a "Version Packages" PR. -# - When that PR is merged: the version in npm/bulltui/package.json bumps, -# the auto-tag job below detects it and pushes a v* tag, which triggers -# the release workflow. - -on: - push: - branches: [main] - -concurrency: ${{ github.workflow }}-${{ github.ref }} - -jobs: - changesets: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v7 - with: - fetch-depth: 0 - - uses: actions/setup-node@v6 - with: - node-version: '24' - - uses: pnpm/action-setup@v6 - - run: pnpm install --frozen-lockfile - - uses: changesets/action@v1 - with: - version: pnpm run version - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - auto-tag: - needs: changesets - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v7 - with: - fetch-depth: 2 - - name: Tag if version bumped - run: | - PREV=$(git show HEAD~1:npm/bulltui/package.json 2>/dev/null \ - | node -e "process.stdin.resume();let d='';process.stdin.on('data',c=>d+=c).on('end',()=>console.log(JSON.parse(d).version))" \ - || echo "") - CURR=$(node -e "console.log(require('./npm/bulltui/package.json').version)") - if [ -n "$CURR" ] && [ "$PREV" != "$CURR" ]; then - git config user.email "github-actions[bot]@users.noreply.github.com" - git config user.name "github-actions[bot]" - git tag "v$CURR" - git push origin "v$CURR" - echo "Tagged v$CURR" - else - echo "No version bump detected (prev=$PREV curr=$CURR), skipping tag." - fi diff --git a/justfile b/justfile index 44779c3..5872581 100644 --- a/justfile +++ b/justfile @@ -73,3 +73,41 @@ npm-pack: # Publish the generated npm packages (needs `npm login` or NODE_AUTH_TOKEN). npm-publish: cargo npm publish + +# --- release ----------------------------------------------------------------- +# The knot is the source of truth; GitHub is a one-way mirror that only runs the +# tag-triggered publish (.github/workflows/release.yml). So versioning happens +# here and the review PR opens on Tangled — not on the mirror. + +# Record a change for the next release (choose the bump, write a summary). +changeset: + pnpm changeset + +# Open a version-bump PR on Tangled: consume changesets onto a branch (bumping +# the version + changelog) and push it, so Tangled raises the PR for review. +version-pr: + #!/usr/bin/env bash + set -euo pipefail + git switch -C release/version-packages main + pnpm install --frozen-lockfile + pnpm run version + git add -A + if git diff --cached --quiet; then + echo "No changesets to version — add one with 'just changeset' first." >&2 + exit 1 + fi + git commit -m "chore: version packages" + git push -f -u origin release/version-packages + echo "Pushed release/version-packages — open its PR into main on Tangled to review + merge." + +# After the version PR merges: tag main so the mirror forwards the tag to +# GitHub, where release.yml builds and publishes. Run from an up-to-date main. +release: + #!/usr/bin/env bash + set -euo pipefail + git switch main + git pull --ff-only + version="v$(node -p "require('./npm/bulltui/package.json').version")" + git tag "$version" + git push origin "$version" + echo "Tagged $version — release.yml publishes once it mirrors to GitHub." -- 2.51.2