From 254295311b0189381b2765cc932737a4f3669be9 Mon Sep 17 00:00:00 2001 From: Jonathan Miller Date: Tue, 21 Apr 2026 16:33:18 -0500 Subject: [PATCH] feat: auto-bump on dev, merge to main via API for stable releases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No more manual bump + merge. Stable releases dispatched from dev will: 1. Auto-bump patch on dev branch 2. Push to dev 3. Merge dev → main via Gitea API (bypasses branch protection) 4. Build ZIP Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/release.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cb4761d..9949c58 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,15 +104,7 @@ jobs: INPUT_SUFFIX: ${{ steps.meta.outputs.suffix }} run: | BRANCH="${{ github.ref_name }}" - - # Skip auto-bump on main — version is already set before merge - if [ "$BRANCH" = "main" ]; then - CURRENT=$(sed -n 's/.*VERSION:[[:space:]]*\([0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\).*/\1/p' README.md 2>/dev/null | head -1) - echo "On main — using current version ${CURRENT} (no bump)" - echo "version=${CURRENT}" >> "$GITHUB_OUTPUT" - echo "zip_name=${EXT_ELEMENT}-${CURRENT}${INPUT_SUFFIX}.zip" >> "$GITHUB_OUTPUT" - exit 0 - fi + GITEA_API="${GITEA_URL}/api/v1/repos/${{ github.repository }}" # Read current version from README.md CURRENT=$(sed -n 's/.*VERSION:[[:space:]]*\([0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]\).*/\1/p' README.md 2>/dev/null | head -1) @@ -163,7 +155,7 @@ jobs: PYEOF fi - # Commit bump + # Commit bump to current branch git config --local user.email "gitea-actions[bot]@mokoconsulting.tech" git config --local user.name "gitea-actions[bot]" git remote set-url origin "https://jmiller:${GA_TOKEN}@git.mokoconsulting.tech/${{ github.repository }}.git" @@ -174,6 +166,21 @@ jobs: git push } + # For stable releases from dev: merge dev → main via Gitea API + if [ "$INPUT_STABILITY" = "stable" ] && [ "$BRANCH" != "main" ]; then + echo "Merging ${BRANCH} → main via Gitea API..." + MERGE_RESULT=$(curl -sf -X POST -H "Authorization: token ${GA_TOKEN}" \ + -H "Content-Type: application/json" \ + "${GITEA_API}/merges" \ + -d "$(jq -n \ + --arg base "main" \ + --arg head "${BRANCH}" \ + --arg msg "chore(release): merge ${BRANCH} for stable ${NEW_VERSION} [skip ci]" \ + '{base: $base, head: $head, merge_message_field: $msg}' + )" 2>&1) || true + echo "Merge result: ${MERGE_RESULT}" + fi + echo "version=${NEW_VERSION}" >> "$GITHUB_OUTPUT" echo "zip_name=${EXT_ELEMENT}-${NEW_VERSION}${INPUT_SUFFIX}.zip" >> "$GITHUB_OUTPUT"