From b74cde8990613502ae1b3d93fa15bc9c96132be6 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 25 Jan 2026 11:52:46 -0800 Subject: [PATCH 1/2] fix(version-bump order in ci): bump the version in the correct order --- .github/workflows/version-bump.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index ff9b6ec..fbf1d90 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -1,7 +1,9 @@ name: Version Bump on: - push: + workflow_run: + workflows: ["CI"] + types: [completed] branches: [main] # Prevent concurrent version bumps @@ -13,8 +15,10 @@ jobs: version-bump: name: Analyze commits and bump version runs-on: ubuntu-latest - # Skip if the commit is from semantic-release itself - if: "!contains(github.event.head_commit.message, 'chore(release):')" + # Only run if CI passed and commit is not from semantic-release + if: > + github.event.workflow_run.conclusion == 'success' && + !contains(github.event.workflow_run.head_commit.message, 'chore(release):') permissions: contents: write From 5e7299f59114387e44b197e459e77bc8b9f9febb Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 25 Jan 2026 12:20:44 -0800 Subject: [PATCH 2/2] fix(ci): remove hardcoded version logic from version-bump --- .github/workflows/release.yml | 26 +++++++++++++++++++++----- .github/workflows/version-bump.yml | 26 ++++++-------------------- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b609756..cfaf2e4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,13 @@ on: push: tags: - 'v*.*.*' + # Manual trigger from GitHub Actions UI + workflow_dispatch: + inputs: + version: + description: 'Version to release (e.g., 1.0.0)' + required: true + type: string # Prevent concurrent releases concurrency: @@ -35,12 +42,16 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Get version from tag + - name: Get version id: get_version shell: bash run: | - # Extract version from tag (removes 'v' prefix) - VERSION=${GITHUB_REF#refs/tags/v} + # Get version from tag or manual input + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + VERSION="${{ github.event.inputs.version }}" + else + VERSION=${GITHUB_REF#refs/tags/v} + fi echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Building version: $VERSION" @@ -95,10 +106,15 @@ jobs: with: fetch-depth: 0 - - name: Get version from tag + - name: Get version id: get_version run: | - VERSION=${GITHUB_REF#refs/tags/v} + # Get version from tag or manual input + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + VERSION="${{ github.event.inputs.version }}" + else + VERSION=${GITHUB_REF#refs/tags/v} + fi echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Download all artifacts diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index fbf1d90..1f21e65 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -43,32 +43,18 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Run semantic-release (dry run) - id: semantic_dry + - name: Run semantic-release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - # Run in dry-run mode first to see what would happen - OUTPUT=$(semantic-release version --no-commit --no-tag --no-push --no-vcs-release 2>&1) || true - echo "Dry run output:" - echo "$OUTPUT" + echo "Current tags:" + git tag -l | tail -5 - # Check if there's a version bump - if echo "$OUTPUT" | grep -q "bump"; then - echo "should_release=true" >> $GITHUB_OUTPUT - else - echo "should_release=false" >> $GITHUB_OUTPUT - fi - - - name: Create version bump and tag - if: steps.semantic_dry.outputs.should_release == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Run semantic-release to bump version, commit, and tag + echo "" + echo "Running semantic-release..." semantic-release version - name: Push changes - if: steps.semantic_dry.outputs.should_release == 'true' run: | + # Push any new commits and tags created by semantic-release git push origin main --follow-tags