From 6530ed77792422d6d3425075bf6cd5913d589f22 Mon Sep 17 00:00:00 2001 From: Paolo Fabbri Date: Fri, 10 Apr 2026 00:09:30 +0100 Subject: [PATCH 1/3] Update make release for PR-only workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit main is now protected — all changes require PRs. Split the release flow into two steps: - make release: bumps version on a release branch, runs CI, commits, pushes, and creates a PR via gh - make tag VERSION=x.y.z: after PR is merged, checks out main, pulls, tags, and pushes the tag to trigger the GitHub Actions release build Co-Authored-By: Claude Opus 4.6 (1M context) --- Makefile | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index bcb684e..316a48e 100644 --- a/Makefile +++ b/Makefile @@ -31,8 +31,9 @@ menu: @printf " $(YELLOW)5)$(RESET) make ci $(DIM)Run lint + test + build (CI pipeline)$(RESET)\n" @printf "\n" @printf " $(BOLD)$(GREEN)=== Release ===$(RESET)\n" - @printf " $(YELLOW)6)$(RESET) make release $(DIM)Bump version, tag, and push$(RESET)\n" - @printf " $(YELLOW)7)$(RESET) make demo $(DIM)Build demo extension for screenshots$(RESET)\n" + @printf " $(YELLOW)6)$(RESET) make release $(DIM)Bump version and create PR$(RESET)\n" + @printf " $(YELLOW)7)$(RESET) make tag $(DIM)Tag merged release and push$(RESET)\n" + @printf " $(YELLOW)8)$(RESET) make demo $(DIM)Build demo extension for screenshots$(RESET)\n" @printf "\n" @read -p " Enter choice: " choice; \ case $$choice in \ @@ -42,7 +43,8 @@ menu: 4) $(MAKE) install ;; \ 5) $(MAKE) ci ;; \ 6) $(MAKE) release ;; \ - 7) $(MAKE) demo ;; \ + 7) $(MAKE) tag ;; \ + 8) $(MAKE) demo ;; \ *) echo "Invalid choice" ;; \ esac @@ -97,20 +99,25 @@ release: esac; \ if [ -z "$$VERSION" ]; then echo "Aborted."; exit 1; fi; \ printf "\n$(BOLD)Releasing $(CYAN)v$$VERSION$(RESET)\n\n"; \ + BRANCH="release/v$$VERSION"; \ + git checkout -b "$$BRANCH"; \ node -e "var p=require('./package.json');p.version='$$VERSION';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"; \ sed -i 's/"version": ".*"/"version": "'"$$VERSION"'"/' manifest.json; \ $(MAKE) ci; \ git add package.json manifest.json; \ git commit -m "Release v$$VERSION"; \ - git tag "v$$VERSION"; \ - printf "\n$(BOLD)$(GREEN)Tagged v$$VERSION$(RESET)\n"; \ - read -p "Push to remote? [y/N] " PUSH; \ - if [ "$$PUSH" = "y" ] || [ "$$PUSH" = "Y" ]; then \ - git push && git push --tags; \ - printf "$(BOLD)$(GREEN)Pushed. GitHub Actions will create the release.$(RESET)\n"; \ - else \ - printf "Run $(CYAN)git push && git push --tags$(RESET) when ready.\n"; \ - fi + git push -u origin "$$BRANCH"; \ + gh pr create --title "Release v$$VERSION" --body "Bump version to $$VERSION" --base main; \ + printf "\n$(BOLD)$(GREEN)PR created for v$$VERSION$(RESET)\n"; \ + printf " After merging, run: $(CYAN)make tag VERSION=$$VERSION$(RESET)\n\n" + +tag: + @if [ -z "$(VERSION)" ]; then echo "Usage: make tag VERSION=x.y.z"; exit 1; fi + @git checkout main + @git pull + @git tag "v$(VERSION)" + @git push --tags + @printf "\n$(BOLD)$(GREEN)Tagged v$(VERSION) — GitHub Actions will create the release.$(RESET)\n" help: @printf "\n" @@ -121,7 +128,8 @@ help: @printf " $(CYAN)make build$(RESET) Create distributable zip\n" @printf " $(CYAN)make install$(RESET) Install dev dependencies\n" @printf " $(CYAN)make ci$(RESET) Run lint + test + build\n" - @printf " $(CYAN)make release$(RESET) Bump version, tag, and push\n" + @printf " $(CYAN)make release$(RESET) Bump version and create PR\n" + @printf " $(CYAN)make tag$(RESET) Tag merged release and push\n" @printf " $(CYAN)make demo$(RESET) Build demo extension for screenshots\n" @printf "\n" From 8629064752a058ad28043117ed9a8fd8694a15f4 Mon Sep 17 00:00:00 2001 From: Paolo Fabbri Date: Fri, 10 Apr 2026 00:14:20 +0100 Subject: [PATCH 2/3] Address CodeRabbit review feedback - Add tag to .PHONY declaration - Create release branch from updated main (checkout + pull --ff-only + clean working tree check) instead of current HEAD - Push only the new tag (git push origin v$VERSION) instead of all local tags (git push --tags) to avoid triggering stale releases - Update README make targets to match new two-step release flow Co-Authored-By: Claude Opus 4.6 (1M context) --- Makefile | 7 +++++-- README.md | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 316a48e..ed41fe6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ .DEFAULT_GOAL := menu -.PHONY: menu install test lint ci build demo release help list +.PHONY: menu install test lint ci build demo release tag help list # Colors CYAN := \033[36m @@ -100,6 +100,9 @@ release: if [ -z "$$VERSION" ]; then echo "Aborted."; exit 1; fi; \ printf "\n$(BOLD)Releasing $(CYAN)v$$VERSION$(RESET)\n\n"; \ BRANCH="release/v$$VERSION"; \ + git checkout main; \ + git pull --ff-only origin main; \ + if [ -n "$$(git status --porcelain)" ]; then echo "Working tree not clean"; exit 1; fi; \ git checkout -b "$$BRANCH"; \ node -e "var p=require('./package.json');p.version='$$VERSION';require('fs').writeFileSync('package.json',JSON.stringify(p,null,2)+'\n')"; \ sed -i 's/"version": ".*"/"version": "'"$$VERSION"'"/' manifest.json; \ @@ -116,7 +119,7 @@ tag: @git checkout main @git pull @git tag "v$(VERSION)" - @git push --tags + @git push origin "v$(VERSION)" @printf "\n$(BOLD)$(GREEN)Tagged v$(VERSION) — GitHub Actions will create the release.$(RESET)\n" help: diff --git a/README.md b/README.md index 3b31e58..dfba7fe 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,8 @@ make lint # Run ESLint make build # Create distributable zip make ci # All of the above make demo # Build demo extension for screenshots -make release # Interactive version bump, tag, and push +make release # Bump version and create PR +make tag # Tag merged release and push ``` ## License From 7547f7c0afffdde037e65938e4cdfdc222ddaa76 Mon Sep 17 00:00:00 2001 From: Paolo Fabbri Date: Fri, 10 Apr 2026 00:15:22 +0100 Subject: [PATCH 3/3] Split CI and release into separate workflows build.yml: runs lint + test + build on PRs and pushes to main (provides the status check required by branch protection). release.yml: runs on v* tag push only, builds both Chrome zip and Firefox xpi, creates GitHub Release with install notes. Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/build.yml | 30 +++------------------ .github/workflows/release.yml | 51 +++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6bc5abf..ce102a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,7 +2,9 @@ name: Build on: push: - tags: ["v*"] + branches: [main] + pull_request: + branches: [main] jobs: build: @@ -24,29 +26,3 @@ jobs: - name: Build Chrome zip run: make build - - - - name: Build Firefox xpi - run: | - npx web-ext build --source-dir=. --artifacts-dir=. \ - --ignore-files="node_modules/*" "test/*" "demo/*" "*.svg" \ - "package*.json" "eslint.config.*" ".github/*" "AGENTS.md" \ - "CLAUDE.md" "CHANGELOG.md" "PRIVACY.md" "README.md" ".gitignore" \ - ".node-version" "docs/*" "Makefile" - mv github_pr_dashboard-*.zip github-pr-dashboard-firefox-unsigned.xpi - - - name: Create GitHub Release - uses: softprops/action-gh-release@v2 - with: - files: | - github-pr-dashboard-chrome.zip - github-pr-dashboard-firefox-unsigned.xpi - generate_release_notes: true - append_body: true - body: | - ## Install - - | Browser | File | Notes | - |---------|------|-------| - | Chrome | `github-pr-dashboard-chrome.zip` | Unzip, then Load unpacked in `chrome://extensions` | - | Firefox | `github-pr-dashboard-firefox-unsigned.xpi` | **Unsigned** — works as a temporary add-on only (removed on browser close). For a persistent install, use the signed version from [addons.mozilla.org](https://addons.mozilla.org) when available. | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c5839cd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release + +on: + push: + tags: ["v*"] + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - run: npm ci + + - name: Lint + run: npx eslint *.js + + - name: Test + run: npm test + + - name: Build Chrome zip + run: make build + + - name: Build Firefox xpi + run: | + npx web-ext build --source-dir=. --artifacts-dir=. \ + --ignore-files="node_modules/*" "test/*" "demo/*" "*.svg" \ + "package*.json" "eslint.config.*" ".github/*" "AGENTS.md" \ + "CLAUDE.md" "CHANGELOG.md" "PRIVACY.md" "README.md" ".gitignore" \ + ".node-version" "docs/*" "Makefile" + mv github_pr_dashboard-*.zip github-pr-dashboard-firefox-unsigned.xpi + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: | + github-pr-dashboard-chrome.zip + github-pr-dashboard-firefox-unsigned.xpi + generate_release_notes: true + append_body: true + body: | + ## Install + + | Browser | File | Notes | + |---------|------|-------| + | Chrome | `github-pr-dashboard-chrome.zip` | Unzip, then Load unpacked in `chrome://extensions` | + | Firefox | `github-pr-dashboard-firefox-unsigned.xpi` | **Unsigned** — works as a temporary add-on only (removed on browser close). For a persistent install, use the signed version from [addons.mozilla.org](https://addons.mozilla.org) when available. |