From bce1a11e7155c74fde9e9168998959f7010b921c Mon Sep 17 00:00:00 2001 From: James Date: Fri, 27 Mar 2026 07:32:38 +0000 Subject: [PATCH] chore(ci): simplify release process to a single workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The 3-workflow chain (release.yml → release-tag.yml → publish.yml) was broken by design: tags created by GITHUB_TOKEN don't trigger other workflows, so merging a release PR never actually published. Consolidate into a single publish.yml that triggers on both tag push and release PR merge. Delete the redundant prepare-release and tag-release workflows. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/publish.yml | 28 +++++++++++++++-- .github/workflows/release-tag.yml | 24 -------------- .github/workflows/release.yml | 52 ------------------------------- CONTRIBUTING.md | 15 ++------- 4 files changed, 29 insertions(+), 90 deletions(-) delete mode 100644 .github/workflows/release-tag.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 424d1cf953..892d83a3b4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -4,6 +4,9 @@ on: push: tags: - "v*" + pull_request: + types: [closed] + branches: [main] jobs: publish: @@ -14,8 +17,29 @@ jobs: permissions: contents: write id-token: write + # Run on tag push OR when a release/* PR is merged + if: >- + github.event_name == 'push' || + (github.event.pull_request.merged == true && + startsWith(github.event.pull_request.head.ref, 'release/v')) steps: - uses: actions/checkout@v4 + + - name: Resolve version + id: version + run: | + if [ "${{ github.event_name }}" = "push" ]; then + echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + else + BRANCH="${{ github.event.pull_request.head.ref }}" + echo "version=${BRANCH#release/v}" >> "$GITHUB_OUTPUT" + fi + + - name: Create release tag + if: github.event_name == 'pull_request' + run: | + git tag "v${{ steps.version.outputs.version }}" + git push origin "v${{ steps.version.outputs.version }}" - uses: oven-sh/setup-bun@v2 - uses: actions/setup-node@v4 with: @@ -31,7 +55,7 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} run: | - VERSION="${GITHUB_REF_NAME#v}" + VERSION="${{ steps.version.outputs.version }}" FAILED=0 publish_pkg() { @@ -89,7 +113,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - VERSION="${GITHUB_REF_NAME#v}" + VERSION="${{ steps.version.outputs.version }}" # Skip if release already exists (idempotent re-runs) if gh release view "v${VERSION}" --repo "${{ github.repository }}" >/dev/null 2>&1; then echo "Release v${VERSION} already exists — skipping" diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml deleted file mode 100644 index d9584f1c3a..0000000000 --- a/.github/workflows/release-tag.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Tag Release - -on: - pull_request: - types: [closed] - branches: [main] - -jobs: - tag: - name: Create release tag - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - uses: actions/checkout@v4 - - - name: Extract version and create tag - run: | - VERSION="${{ github.event.pull_request.head.ref }}" - VERSION="${VERSION#release/}" - echo "Tagging ${VERSION}" - git tag "${VERSION}" - git push origin "${VERSION}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 64ab16a2a4..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Prepare Release - -on: - workflow_dispatch: - inputs: - version: - description: "Version to release (e.g., 0.2.0, 1.0.0-beta.1)" - required: true - type: string - -jobs: - prepare: - name: Prepare release PR - runs-on: ubuntu-latest - timeout-minutes: 5 - permissions: - contents: write - pull-requests: write - steps: - - uses: actions/checkout@v4 - - uses: oven-sh/setup-bun@v2 - - uses: actions/setup-node@v4 - with: - node-version: 22 - - run: bun install --frozen-lockfile - - - name: Bump versions - run: bun run set-version ${{ inputs.version }} - - - name: Create release PR - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - BRANCH="release/v${{ inputs.version }}" - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - git checkout -b "$BRANCH" - git add packages/*/package.json - git commit -m "chore: release v${{ inputs.version }}" - git push origin "$BRANCH" - gh pr create \ - --title "chore: release v${{ inputs.version }}" \ - --body "$(cat <<'BODY' - ## Release v${{ inputs.version }} - - Bumps all packages to v${{ inputs.version }}. - - **After merging**, the release tag is created automatically, which triggers npm publish. - BODY - )" \ - --base main \ - --head "$BRANCH" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 36a07f973f..0806a1e112 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -59,27 +59,18 @@ Git hooks (via [lefthook](https://github.com/evilmartians/lefthook)) run automat All packages use **fixed versioning** — every release bumps all packages to the same version. -### Via GitHub UI (recommended) - -1. Go to **Actions** → **Prepare Release** → **Run workflow** -2. Enter the version (e.g., `0.2.0`) -3. Click **Run workflow** — this creates a release PR -4. Review and merge the PR -5. Merging auto-creates the `v0.2.0` tag, which triggers npm publish and a GitHub Release - -### Via CLI - ```bash -# Bump versions, commit to a branch, create PR bun run set-version 0.2.0 git checkout -b release/v0.2.0 git add packages/*/package.json git commit -m "chore: release v0.2.0" git push origin release/v0.2.0 gh pr create --title "chore: release v0.2.0" --base main -# After merge, the tag + publish happen automatically +# After merge, tag + npm publish + GitHub Release happen automatically ``` +You can also publish manually by pushing a tag: `git tag v0.2.0 && git push origin v0.2.0` + ## Reporting Issues - Use [GitHub Issues](https://github.com/heygen-com/hyperframes/issues) for bug reports and feature requests