From 8aa109274a7fb29ba0cd5ab2fea9b3e346438cc9 Mon Sep 17 00:00:00 2001 From: Kevin Maes Date: Fri, 19 Dec 2025 16:40:04 +0200 Subject: [PATCH 1/3] feat: add automatic GitHub Release creation on promote to main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Creates GitHub Releases with version tags and changelog content when code is promoted to main branch. Includes idempotency check to skip if tag already exists. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .changeset/github-releases.md | 5 +++ .github/workflows/promote-to-main.yml | 45 +++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 .changeset/github-releases.md diff --git a/.changeset/github-releases.md b/.changeset/github-releases.md new file mode 100644 index 0000000..d62e334 --- /dev/null +++ b/.changeset/github-releases.md @@ -0,0 +1,5 @@ +--- +"eggdrop": patch +--- + +Add automatic GitHub Release creation when promoting to main. Releases are created with version tags (v0.x.x) and changelog content extracted from CHANGELOG.md. diff --git a/.github/workflows/promote-to-main.yml b/.github/workflows/promote-to-main.yml index 3b7842a..b750298 100644 --- a/.github/workflows/promote-to-main.yml +++ b/.github/workflows/promote-to-main.yml @@ -40,7 +40,52 @@ jobs: git merge origin/dev --no-edit git push origin main + - name: Get version from package.json + id: get-version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + + - name: Check if tag exists + id: tag-check + run: | + if git rev-parse "v${{ steps.get-version.outputs.version }}" >/dev/null 2>&1; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + - name: Create and push tag + if: steps.tag-check.outputs.exists == 'false' + run: | + git tag "v${{ steps.get-version.outputs.version }}" + git push origin "v${{ steps.get-version.outputs.version }}" + + - name: Extract changelog for this version + if: steps.tag-check.outputs.exists == 'false' + id: changelog + run: | + VERSION="${{ steps.get-version.outputs.version }}" + # Extract content between this version header and the next version header + CHANGELOG=$(sed -n "/^## ${VERSION}$/,/^## [0-9]/p" CHANGELOG.md | sed '$d' | tail -n +2) + echo "content<> $GITHUB_OUTPUT + echo "$CHANGELOG" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Create GitHub Release + if: steps.tag-check.outputs.exists == 'false' + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.get-version.outputs.version }} + name: v${{ steps.get-version.outputs.version }} + body: ${{ steps.changelog.outputs.content }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Summary run: | echo "✅ Successfully merged dev into main" echo "🚀 Vercel will now deploy to production" + if [ "${{ steps.tag-check.outputs.exists }}" == "false" ]; then + echo "📦 Created GitHub Release v${{ steps.get-version.outputs.version }}" + else + echo "⏭️ Skipped release creation (tag v${{ steps.get-version.outputs.version }} already exists)" + fi From 635070c82306d117ade3360049010710e27366ad Mon Sep 17 00:00:00 2001 From: Kevin Maes Date: Fri, 19 Dec 2025 16:47:05 +0200 Subject: [PATCH 2/3] Update settings --- .claude/settings.local.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index a10629d..2e4f52f 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -30,7 +30,9 @@ "Bash(pnpm changeset:*)", "Bash(source ~/.nvm/nvm.sh)", "Bash(nvm use:*)", - "Bash(pnpm exec playwright test:*)" + "Bash(pnpm exec playwright test:*)", + "Bash(git push:*)", + "Bash(npm install:*)" ], "deny": [], "ask": [] From 8c81627c672505daba07d9c93ee00c31b19ffd5a Mon Sep 17 00:00:00 2001 From: Kevin Maes Date: Fri, 19 Dec 2025 16:51:58 +0200 Subject: [PATCH 3/3] refactor: rename workflow to auto-promote-and-release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Renames promote-to-main.yml to auto-promote-and-release.yml to better reflect that it automatically triggers and creates GitHub Releases. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .changeset/github-releases.md | 2 +- .../{promote-to-main.yml => auto-promote-and-release.yml} | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{promote-to-main.yml => auto-promote-and-release.yml} (94%) diff --git a/.changeset/github-releases.md b/.changeset/github-releases.md index d62e334..7c498fd 100644 --- a/.changeset/github-releases.md +++ b/.changeset/github-releases.md @@ -2,4 +2,4 @@ "eggdrop": patch --- -Add automatic GitHub Release creation when promoting to main. Releases are created with version tags (v0.x.x) and changelog content extracted from CHANGELOG.md. +Rename promote-to-main workflow to auto-promote-and-release and add automatic GitHub Release creation. Releases are created with version tags (v0.x.x) and changelog content extracted from CHANGELOG.md. diff --git a/.github/workflows/promote-to-main.yml b/.github/workflows/auto-promote-and-release.yml similarity index 94% rename from .github/workflows/promote-to-main.yml rename to .github/workflows/auto-promote-and-release.yml index b750298..71dbb08 100644 --- a/.github/workflows/promote-to-main.yml +++ b/.github/workflows/auto-promote-and-release.yml @@ -1,6 +1,6 @@ # Automatically merges dev into main after a "Version Packages" PR is merged -# This completes the release process - Vercel will auto-deploy main to production -name: Promote to Main +# Creates a GitHub Release with changelog, then Vercel auto-deploys main to production +name: Auto Promote and Release on: pull_request: @@ -10,8 +10,8 @@ on: workflow_dispatch: jobs: - promote: - name: Merge dev to main + promote-and-release: + name: Promote to main and create release runs-on: ubuntu-latest # Only run if PR was merged (not just closed) AND is a Version Packages PR # For workflow_dispatch, always run