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
26 changes: 21 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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
Expand Down
36 changes: 13 additions & 23 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Version Bump

on:
push:
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [main]

# Prevent concurrent version bumps
Expand All @@ -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
Expand All @@ -39,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