From b42611967d366dc33814d52c37f926502f330abf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 26 Oct 2025 21:08:03 +1100 Subject: [PATCH] refactor: separate Docker and GitHub release workflows for better modularity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split the monolithic publish workflow into docker-release and github-release workflows to improve separation of concerns and allow independent execution. GitHub releases now trigger as a dependent workflow after successful Docker builds. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../{publish.yml => docker-release.yml} | 36 +-------- .github/workflows/github-release.yml | 79 +++++++++++++++++++ .../{release.yml => version-release.yml} | 2 +- 3 files changed, 81 insertions(+), 36 deletions(-) rename .github/workflows/{publish.yml => docker-release.yml} (76%) create mode 100644 .github/workflows/github-release.yml rename .github/workflows/{release.yml => version-release.yml} (99%) diff --git a/.github/workflows/publish.yml b/.github/workflows/docker-release.yml similarity index 76% rename from .github/workflows/publish.yml rename to .github/workflows/docker-release.yml index 48a0649..7f179a1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/docker-release.yml @@ -1,4 +1,4 @@ -name: Publish Release +name: Docker Release on: push: @@ -115,37 +115,3 @@ jobs: BUILD_DATE=${{ github.event.repository.updated_at }} VCS_REF=${{ github.sha }} VERSION=${{ needs.extract-version.outputs.version }} - - github-release: - name: Create GitHub Release - runs-on: ubuntu-latest - needs: [extract-version, docker-build] - environment: prod - - steps: - - name: Checkout code - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Auto-generate release notes if missing - run: .github/scripts/generate_release_notes.sh -v "${{ needs.extract-version.outputs.version }}" -k "${{ secrets.GEMINI_API_KEY }}" -p - - - uses: DavidAnson/markdownlint-cli2-action@v20 - with: - fix: true - globs: '**/*.md' - continue-on-error: true - - - name: Generate release notes - id: release-notes - run: .github/scripts/extract_release_notes.sh "${{ needs.extract-version.outputs.version }}" - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - tag_name: v${{ needs.extract-version.outputs.version }} - name: Release ${{ needs.extract-version.outputs.version }} - body_path: release_notes.md - prerelease: ${{ needs.extract-version.outputs.is_prerelease }} - draft: false diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 0000000..a306b48 --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,79 @@ +name: GitHub Release + +on: + workflow_run: + workflows: ["Publish Release"] + types: + - completed + branches: + - 'release/**' + workflow_dispatch: + +permissions: + contents: write + +jobs: + create-github-release: + name: Create GitHub Release + runs-on: ubuntu-latest + # Only run if the upstream workflow succeeded + if: ${{ github.event.workflow_run.conclusion == 'success' }} + environment: prod + + steps: + - name: Checkout code + uses: actions/checkout@v5 + with: + ref: ${{ github.event.workflow_run.head_branch }} + fetch-depth: 0 + + - name: Extract version from branch + id: extract + run: | + # Extract version from branch name (release/1.2.3 -> 1.2.3) + BRANCH_NAME="${{ github.event.workflow_run.head_branch }}" + VERSION="${BRANCH_NAME#release/}" + echo "Branch version: $VERSION" + + # Read version from version.py + FILE_VERSION=$(grep -oP '__version__ = "\K[^"]+' src/version.py) + echo "File version: $FILE_VERSION" + + # Verify they match + if [ "$VERSION" != "$FILE_VERSION" ]; then + echo "Error: Branch version ($VERSION) does not match version.py ($FILE_VERSION)" + exit 1 + fi + + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + # Check if pre-release (contains hyphen) + if echo "$VERSION" | grep -q '-'; then + echo "is_prerelease=true" >> "$GITHUB_OUTPUT" + echo "Detected pre-release version: $VERSION" + else + echo "is_prerelease=false" >> "$GITHUB_OUTPUT" + echo "Detected stable release version: $VERSION" + fi + + - name: Auto-generate release notes if missing + run: .github/scripts/generate_release_notes.sh -v "${{ steps.extract.outputs.version }}" -k "${{ secrets.GEMINI_API_KEY }}" -p + + - uses: DavidAnson/markdownlint-cli2-action@v20 + with: + fix: true + globs: '**/*.md' + continue-on-error: true + + - name: Generate release notes + id: release-notes + run: .github/scripts/extract_release_notes.sh "${{ steps.extract.outputs.version }}" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.extract.outputs.version }} + name: Release ${{ steps.extract.outputs.version }} + body_path: release_notes.md + prerelease: ${{ steps.extract.outputs.is_prerelease }} + draft: false diff --git a/.github/workflows/release.yml b/.github/workflows/version-release.yml similarity index 99% rename from .github/workflows/release.yml rename to .github/workflows/version-release.yml index 05a5a75..e574bd9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/version-release.yml @@ -1,4 +1,4 @@ -name: Create Release +name: Create Version Release on: workflow_dispatch: