Skip to content

Commit 87fd454

Browse files
committed
ci: simplify release workflow and flatten npm-publish approval chain
- Drop auto-generated RELEASES.md prepending (notes are written manually in PR) - Flatten npm-publish job dependencies so all publish jobs wait for approval together instead of sequentially, reducing 3 approval clicks to 1 - Remove Release environment from publish-mcpb (only needs GH_TOKEN) - Use --generate-notes for GitHub Release creation
1 parent f310b22 commit 87fd454

3 files changed

Lines changed: 15 additions & 31 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ jobs:
4242
- run: npm ci
4343
- run: npm test
4444

45+
# All publish jobs depend directly on [build, test] (not on each other) so
46+
# they all enter "waiting for approval" together and can be approved in a
47+
# single "Review deployments" click.
48+
4549
publish:
4650
runs-on: ubuntu-latest
4751
if: github.event_name == 'release'
@@ -88,7 +92,7 @@ jobs:
8892
runs-on: ubuntu-latest
8993
if: github.event_name == 'release'
9094
environment: Release
91-
needs: [publish]
95+
needs: [build, test]
9296

9397
permissions:
9498
contents: read
@@ -142,8 +146,7 @@ jobs:
142146
publish-mcpb:
143147
runs-on: ubuntu-latest
144148
if: github.event_name == 'release'
145-
environment: Release
146-
needs: [publish-examples]
149+
needs: [build, test]
147150

148151
permissions:
149152
contents: write

.github/workflows/release.yml

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ env:
2323
GH_TOKEN: ${{ github.token }}
2424

2525
jobs:
26+
# Opens a PR that bumps all package versions. Add release notes to
27+
# RELEASES.md in the PR before merging.
2628
prepare:
2729
if: github.event_name == 'workflow_dispatch'
2830
runs-on: ubuntu-latest
@@ -39,28 +41,6 @@ jobs:
3941
VERSION=$(node scripts/bump-version.mjs "${{ inputs.bump }}" --preid="${{ inputs.preid }}")
4042
echo "version=$VERSION" >> $GITHUB_OUTPUT
4143
42-
- name: Generate release notes and prepend to RELEASES.md
43-
run: |
44-
VERSION="${{ steps.bump.outputs.version }}"
45-
PREV_TAG=$(gh release list --repo ${{ github.repository }} --limit 1 --json tagName -q '.[0].tagName // ""')
46-
gh api repos/${{ github.repository }}/releases/generate-notes \
47-
-f tag_name="v$VERSION" \
48-
-f target_commitish="${{ github.ref_name }}" \
49-
${PREV_TAG:+-f previous_tag_name="$PREV_TAG"} \
50-
--jq .body > /tmp/notes.md
51-
{
52-
echo "# Release Notes"
53-
echo ""
54-
echo "## $VERSION"
55-
echo ""
56-
cat /tmp/notes.md
57-
echo ""
58-
echo "---"
59-
echo ""
60-
tail -n +2 RELEASES.md
61-
} > RELEASES.md.new
62-
mv RELEASES.md.new RELEASES.md
63-
6444
- name: Create release PR
6545
run: |
6646
VERSION="${{ steps.bump.outputs.version }}"
@@ -73,10 +53,12 @@ jobs:
7353
git push -f -u origin "$BRANCH"
7454
gh pr create \
7555
--title "chore: release v$VERSION" \
76-
--body "Bumps all packages to \`$VERSION\` and updates RELEASES.md. Merging this PR will automatically tag and publish the release." \
56+
--body "Bumps all packages to \`$VERSION\`. Add release notes to \`RELEASES.md\` before merging. Merging this PR will automatically tag and create the GitHub Release, which triggers npm-publish." \
7757
--label release \
7858
--base main || gh pr edit "$BRANCH" --title "chore: release v$VERSION"
7959
60+
# When a release PR is merged, tag the commit and create the GitHub Release.
61+
# This triggers the npm-publish workflow.
8062
tag:
8163
if: >
8264
github.event_name == 'pull_request' &&
@@ -96,9 +78,8 @@ jobs:
9678
echo "Release $TAG already exists, skipping"
9779
exit 0
9880
fi
99-
awk '/^## /{if(seen++) exit} seen' RELEASES.md | tail -n +2 | sed '/^---$/,$d' > /tmp/notes.md
10081
git tag "$TAG"
10182
git push origin "$TAG"
10283
PRERELEASE=""
10384
[[ "$VERSION" == *-* ]] && PRERELEASE="--prerelease"
104-
gh release create "$TAG" --title "$TAG" --notes-file /tmp/notes.md $PRERELEASE
85+
gh release create "$TAG" --title "$TAG" --generate-notes $PRERELEASE

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -541,11 +541,11 @@ Releases are automated via the [Release workflow](https://github.com/modelcontex
541541
- Click "Run workflow"
542542

543543
2. **Review the release PR**:
544-
- The workflow bumps the version across all packages, generates release notes, and opens a PR labeled `release`
545-
- Edit `RELEASES.md` in the PR if you want to adjust the generated notes
544+
- The workflow bumps the version across all packages and opens a PR labeled `release`
545+
- Add release notes to `RELEASES.md` in the PR
546546
- Approve and merge the PR
547547

548-
3. **Done** — merging the PR automatically tags the commit, creates the GitHub Release, and triggers the [npm-publish workflow](https://github.com/modelcontextprotocol/ext-apps/actions/workflows/npm-publish.yml) to publish to npm.
548+
3. **Done** — merging the PR automatically tags the commit and creates the GitHub Release (with auto-generated notes), which triggers the [npm-publish workflow](https://github.com/modelcontextprotocol/ext-apps/actions/workflows/npm-publish.yml). Approve the deployment once when prompted.
549549

550550
#### Manual alternative
551551

0 commit comments

Comments
 (0)