Skip to content

ci: merge-and-auto-release workflow (draft-release approval) - #34

Merged
Carl723000 merged 2 commits into
ClaudeCodeUsage:mainfrom
nickearnshaw:ci/merge-and-auto-release
Jun 15, 2026
Merged

Carl723000 merged 2 commits into
ClaudeCodeUsage:mainfrom
nickearnshaw:ci/merge-and-auto-release

Conversation

@nickearnshaw

@nickearnshaw nickearnshaw commented Jun 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This implements a merge-and-auto-release workflow so a maintainer's only per-PR action becomes Merge / Reject, and a release auto-drafts for one-click approval. Changes ship by merging PRs rather than re-applying them by hand, which preserves contributor commit authorship and the PR's merged status.

Companion discussion: #33 (the rationale + the release-drafter-vs-release-please options comparison). This PR implements the recommended option, Release Drafter; happy to swap it to release-please instead if you'd prefer.

How it works after this lands

  1. Open a PR → a maintainer applies a version label at merge (unlabeled defaults to patch); the label sets the bump (feature → minor, breaking → major, else patch).
  2. Maintainer merges → release-drafter.yml updates a single draft GitHub Release (categorised notes + next semver version).
  3. Maintainer clicks Publish on the draft → creates the tag → publish.yml (now triggered on release: published) stamps package.json from the tag, compiles, packages, and publishes to the VS Code Marketplace + Open VSX, attaching the .vsix.

No manual version bump, no git tag, no re-applying PRs by hand.

Changes

  • .github/release-drafter.yml (new) — release-notes categories, label→semver version-resolver, and an autolabeler block kept ready to enable for same-repo PRs.
  • .github/workflows/release-drafter.yml (new) — runs on push to main to keep the draft Release current (push-only, since fork-PR tokens are read-only — see the note in the file).
  • .github/workflows/publish.yml — trigger switched from push: tags: v* → release: types: [published]; the tag-vs-package.json guard is replaced by a build-time stamp version from the release tag step (so the tag is the single source of truth and a mismatch is impossible); the .vsix is uploaded to the already-published Release without regenerating its notes.
  • CONTRIBUTING.md, CLAUDE.md, .github/PULL_REQUEST_TEMPLATE.md — document the new flow and map change type → release label.

Unchanged: the VSCE_PAT / OVSX_PAT secrets and the Marketplace / Open VSX publish steps.

Recommended companion setting (not a file)

Enable branch protection on main requiring a PR before merge, so Merge is the clean, gated path rather than a manual re-apply.

How this was tested

  • YAML parses clean on all three workflow/config files.
  • The flow can be verified end-to-end on a fork without shipping a real build: open a labelled test PR → confirm the draft Release updates on merge → publish a throwaway 0.0.0-test pre-release to confirm publish.yml fires on release: published and stamps the version.

Type of change

  • Documentation / CI / chore

Replace the hand-tagged release flow with a merge-and-approve one so a
maintainer's only per-PR action is Merge/Reject, and releases auto-draft for
one-click approval — preserving contributor attribution (PRs get *merged*, not
re-applied).

- add release-drafter: a draft GitHub Release is kept up to date as labelled PRs
  merge to main; next semver version inferred from PR labels; PRs auto-labelled
  from branch/title prefix
- publish.yml: trigger on `release: published` instead of `v*` tag push; stamp
  package.json version from the release tag (no hand-bump, no tag/version
  mismatch) and drop the tag-vs-package.json guard; upload the .vsix to the
  existing Release without regenerating its notes
- docs: CONTRIBUTING.md + CLAUDE.md describe the new flow; PR template maps
  change type -> release label

This is "option A" (release-drafter) of two approaches; release-please is the
documented alternative in the proposal issue.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Release Drafter reads its config from the default branch and the default
GITHUB_TOKEN is read-only for fork PRs, so a pull_request autolabeler can't work
for external contributions and fails on first introduction (config not yet on
the default branch). Drop the pull_request trigger: drafting runs on push to
main, maintainers set the version label at merge. Reword docs accordingly; the
autolabeler block stays as a ready-to-enable option.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
contents: write # create / update the draft release
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v6

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for addressing this issue.
As a security engineer, I totally support this change.
In the same line, please make sure that the commit is pinned instead of attached to a version such as @v6

Should release-drafter/release-drafter be compromised and publish a new evil release e.g. v6.6.6. You are compromised by supply chain.
If you pin the commit instead you won't be impacted.

Suggested change
- uses: release-drafter/release-drafter@v6
- uses: release-drafter/release-drafter@693d20e7c1ce1a81d3a41962f85914253b518449 #v7.3.1

@Carl723000
Carl723000 merged commit d9dd31b into ClaudeCodeUsage:main Jun 15, 2026
1 check passed
@Carl723000 Carl723000 added the ci CI / workflow change label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI / workflow change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants