diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c37bf86 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release + +# Publishes a GitHub release when plugin.json on main carries a version that +# has no release yet. Notes come from the matching CHANGELOG.md section. +on: + push: + branches: [main] + paths: [plugin.json] + workflow_dispatch: + +permissions: + contents: write + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Validate + run: node scripts/validate.mjs + - name: Read version + id: version + run: echo "version=$(node -p "require('./plugin.json').version")" >> "$GITHUB_OUTPUT" + - name: Publish release if missing + env: + GH_TOKEN: ${{ github.token }} + VERSION: ${{ steps.version.outputs.version }} + run: | + tag="v$VERSION" + if gh release view "$tag" >/dev/null 2>&1; then + echo "Release $tag already exists, nothing to do." + exit 0 + fi + node scripts/release-notes.mjs "$VERSION" > notes.md + flags=() + if [[ "$VERSION" == *-* ]]; then flags+=(--prerelease); fi + gh release create "$tag" --target "$GITHUB_SHA" --title "$tag" --notes-file notes.md "${flags[@]}" diff --git a/CHANGELOG.md b/CHANGELOG.md index 76d6a96..f6d7f0c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project are documented here. Versions follow [Semant ## [Unreleased] +### Added + +- Release workflow: merging a version bump to `main` tags it and publishes a GitHub release, with notes built from this changelog by `scripts/release-notes.mjs`. + ## [2.0.0] - 2026-10-17 ### Breaking diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0a97bac..6ab69d4 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,6 +12,8 @@ | `evals/routing.json` | Routing test cases | | `scripts/validate.mjs` | Static checks, run in CI | | `scripts/eval-routing.mjs` | Routing eval, run locally | +| `scripts/release-notes.mjs` | Builds release notes from `CHANGELOG.md` | +| `.github/workflows/release.yml` | Publishes a GitHub release when the version changes | ## Making a change @@ -32,9 +34,9 @@ Documentation style: plain ASCII punctuation, no emoji, no em dashes. `validate. ## Releasing -1. Bump the version in `plugin.json` and in both places in `.github/plugin/marketplace.json` (`metadata.version` and the plugin entry). -2. Move the Unreleased changelog notes under a heading for the new version. -3. Run `node scripts/validate.mjs`, then merge to `main`. -4. Tag and publish: `git tag vX.Y.Z && git push origin vX.Y.Z`, then create a GitHub release from the tag. +1. In your PR, bump the version in `plugin.json` and in both places in `.github/plugin/marketplace.json` (`metadata.version` and the plugin entry). Use semver; a version with a suffix such as `2.1.0-rc.1` is published as a prerelease. +2. Move the Unreleased changelog notes under a `## [X.Y.Z] - YYYY-MM-DD` heading. +3. Run `node scripts/validate.mjs` and preview the notes with `node scripts/release-notes.mjs`. +4. Merge to `main`. The Release workflow (`.github/workflows/release.yml`) sees the new version in `plugin.json`, validates, creates the `vX.Y.Z` tag on the merge commit and publishes a GitHub release with the changelog section as notes. If a run fails, fix the cause and re-run it from the Actions tab (it has a manual trigger); it skips versions that are already released. Users pick up the release with `copilot plugin marketplace update agentcouncil` and `copilot plugin update agentcouncil@agentcouncil`. Listings that pin a tag, such as an awesome-copilot external entry, need their ref bumped separately. diff --git a/README.md b/README.md index 53b5f08..1408103 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ copilot plugin marketplace add Sentry01/AgentCouncil copilot plugin install agentcouncil@agentcouncil ``` -Update to the latest release: +Update to the latest release ([release notes](https://github.com/Sentry01/AgentCouncil/releases)): ```bash copilot plugin marketplace update agentcouncil diff --git a/scripts/release-notes.mjs b/scripts/release-notes.mjs new file mode 100644 index 0000000..cf1f128 --- /dev/null +++ b/scripts/release-notes.mjs @@ -0,0 +1,43 @@ +#!/usr/bin/env node +// Prints GitHub release notes for a version: install and update commands, then +// the matching CHANGELOG.md section. Fails if the section is missing or empty. +// Usage: node scripts/release-notes.mjs [version] [--no-install] +// The version defaults to the one in plugin.json. + +import { readFileSync } from "node:fs"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const args = process.argv.slice(2); +const version = args.find((a) => !a.startsWith("--")) || JSON.parse(readFileSync(join(root, "plugin.json"), "utf8")).version; + +const lines = readFileSync(join(root, "CHANGELOG.md"), "utf8").split("\n"); +const start = lines.findIndex((l) => l.startsWith(`## [${version}]`)); +if (start < 0) { + console.error(`CHANGELOG.md has no "## [${version}]" section.`); + process.exit(1); +} +const rest = lines.slice(start + 1); +const end = rest.findIndex((l) => l.startsWith("## [")); +const section = (end < 0 ? rest : rest.slice(0, end)).join("\n").trim(); +if (!section) { + console.error(`CHANGELOG.md section for ${version} is empty.`); + process.exit(1); +} + +const install = `## Install or update + +\`\`\`bash +# First install +copilot plugin marketplace add Sentry01/AgentCouncil +copilot plugin install agentcouncil@agentcouncil + +# Update an existing install +copilot plugin marketplace update agentcouncil +copilot plugin update agentcouncil@agentcouncil +\`\`\` + +`; + +process.stdout.write(`${args.includes("--no-install") ? "" : install}${section.replace(/^### /gm, "## ")}\n`);