Skip to content

Commit 43065d0

Browse files
committed
feat: release workflow
1 parent ead4fed commit 43065d0

2 files changed

Lines changed: 175 additions & 82 deletions

File tree

Lines changed: 74 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Changeset Release
2-
run-name: Changeset Release ${{ github.actor != 'R00-B0T' && '- Create PR' || '- Update Changelog' }}
2+
run-name: Changeset Release ${{ github.event_name != 'pull_request' && '- Create PR' || github.event.pull_request.user.login != vars.RELEASE_BOT_LOGIN && '- Create PR' || '- Validate Version PR' }}
33

44
on:
55
workflow_dispatch:
@@ -9,24 +9,37 @@ on:
99
env:
1010
REPO_PATH: ${{ github.repository }}
1111
GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }}
12+
VERSION_BUMP_PR_TITLE: Zoo Code changeset version bump
1213

1314
jobs:
1415
# Job 1: Create version bump PR when changesets are merged to main
1516
changeset-pr-version-bump:
17+
# Loop guard: title comparison skips the version-bump PR itself so the job
18+
# doesn't recurse when that PR merges. The title is set by VERSION_BUMP_PR_TITLE.
1619
if: >
1720
( github.event_name == 'pull_request' &&
1821
github.event.pull_request.merged == true &&
1922
github.event.pull_request.base.ref == 'main' &&
20-
github.actor != 'R00-B0T' ) ||
23+
github.event.pull_request.title != 'Zoo Code changeset version bump' ) ||
2124
github.event_name == 'workflow_dispatch'
2225
runs-on: ubuntu-latest
2326
permissions:
2427
contents: write
2528
pull-requests: write
2629
steps:
30+
- name: Generate release bot token
31+
id: release-bot-token
32+
uses: actions/create-github-app-token@v3
33+
with:
34+
app-id: ${{ vars.RELEASE_APP_ID }}
35+
private-key: ${{ secrets.RELEASE_APP_PRIVATE_KEY }}
36+
permission-contents: write
37+
permission-pull-requests: write
38+
2739
- name: Git Checkout
2840
uses: actions/checkout@v4
2941
with:
42+
token: ${{ steps.release-bot-token.outputs.token }}
3043
fetch-depth: 0
3144
ref: ${{ env.GIT_REF }}
3245
- name: Setup Node.js and pnpm
@@ -46,39 +59,46 @@ jobs:
4659
id: changesets
4760
uses: changesets/action@v1
4861
with:
49-
commit: "changeset version bump"
50-
title: "Changeset version bump"
62+
commit: "chore: zoo code changeset version bump"
63+
title: ${{ env.VERSION_BUMP_PR_TITLE }}
5164
version: pnpm changeset:version # This performs the changeset version bump
5265
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
GITHUB_TOKEN: ${{ steps.release-bot-token.outputs.token }}
5467

55-
# Job 2: Process version bump PR created by R00-B0T
56-
changeset-pr-edit-approve:
57-
name: Auto approve and merge Bump version PRs
68+
# Job 2: Validate and approve version bump PRs created by the release bot
69+
changeset-pr-validate-approve:
70+
name: Validate and approve Bump version PRs
5871
runs-on: ubuntu-latest
5972
permissions:
6073
contents: write
6174
pull-requests: write
6275
if: >
6376
github.event_name == 'pull_request' &&
6477
github.event.pull_request.base.ref == 'main' &&
65-
github.actor == 'R00-B0T' &&
66-
contains(github.event.pull_request.title, 'Changeset version bump')
78+
github.event.pull_request.user.login == vars.RELEASE_BOT_LOGIN &&
79+
github.event.pull_request.title == 'Zoo Code changeset version bump'
6780
steps:
6881
- name: Determine checkout ref
6982
id: checkout-ref
83+
env:
84+
EVENT_ACTION: ${{ github.event.action }}
85+
HEAD_REF: ${{ github.head_ref }}
86+
PR_SHA: ${{ github.event.pull_request.head.sha }}
87+
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
88+
RELEASE_BOT_LOGIN: ${{ vars.RELEASE_BOT_LOGIN }}
7089
run: |
71-
echo "Event action: ${{ github.event.action }}"
90+
echo "Event action: $EVENT_ACTION"
7291
echo "Actor: ${{ github.actor }}"
73-
echo "Head ref: ${{ github.head_ref }}"
74-
echo "PR SHA: ${{ github.event.pull_request.head.sha }}"
92+
echo "Head ref: $HEAD_REF"
93+
echo "PR SHA: $PR_SHA"
94+
echo "PR author: $PR_AUTHOR"
7595
76-
if [[ "${{ github.event.action }}" == "opened" && "${{ github.actor }}" == "R00-B0T" ]]; then
77-
echo "Using branch ref: ${{ github.head_ref }}"
78-
echo "git_ref=${{ github.head_ref }}" >> $GITHUB_OUTPUT
96+
if [[ "$EVENT_ACTION" == "opened" && "$PR_AUTHOR" == "$RELEASE_BOT_LOGIN" ]]; then
97+
echo "Using branch ref: $HEAD_REF"
98+
echo "git_ref=$HEAD_REF" >> $GITHUB_OUTPUT
7999
else
80-
echo "Using SHA ref: ${{ github.event.pull_request.head.sha }}"
81-
echo "git_ref=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT
100+
echo "Using SHA ref: $PR_SHA"
101+
echo "git_ref=$PR_SHA" >> $GITHUB_OUTPUT
82102
fi
83103
84104
- name: Checkout Repo
@@ -88,22 +108,42 @@ jobs:
88108
fetch-depth: 0
89109
ref: ${{ steps.checkout-ref.outputs.git_ref }}
90110

91-
# Commit and push changelog updates
92-
- name: Push Changelog updates
93-
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-ready') }}
111+
- name: Setup Node.js and pnpm
112+
uses: ./.github/actions/setup-node-pnpm
113+
with:
114+
install-args: "--frozen-lockfile"
115+
116+
- name: Build workspace packages
117+
run: |
118+
pnpm --filter @roo-code/build build
119+
pnpm --filter @roo-code/vscode-webview build
120+
121+
- name: Validate version bump PR
122+
env:
123+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
94124
run: |
95-
git config user.name "R00-B0T"
96-
git config user.email github-actions@github.com
97-
echo "Running git add and commit..."
98-
git add CHANGELOG.md
99-
git commit -m "Updating CHANGELOG.md format"
100-
git status
101-
echo "--------------------------------------------------------------------------------"
102-
echo "Pushing to remote..."
103-
echo "--------------------------------------------------------------------------------"
104-
git push
105-
106-
# Add label to indicate changelog has been formatted
125+
package_name=$(node -p "require('./src/package.json').name")
126+
publisher=$(node -p "require('./src/package.json').publisher")
127+
package_version=$(node -p "require('./src/package.json').version")
128+
129+
test "$package_name" = "zoo-code"
130+
test "$publisher" = "ZooCodeOrganization"
131+
132+
node -e 'const version = process.argv[1]; if (!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(version)) { throw new Error("Invalid SemVer version: " + version) }' "$package_version"
133+
grep -q "## \\[$package_version\\]\\|## $package_version" CHANGELOG.md
134+
135+
pnpm --filter ./src bundle --production
136+
cmp README.md src/README.md
137+
138+
pnpm --filter ./src vsix
139+
test -f "bin/zoo-code-${package_version}.vsix"
140+
141+
artifact_name=$(unzip -p "bin/zoo-code-${package_version}.vsix" extension/package.json | jq -r '.name')
142+
artifact_publisher=$(unzip -p "bin/zoo-code-${package_version}.vsix" extension/package.json | jq -r '.publisher')
143+
test "$artifact_name" = "zoo-code"
144+
test "$artifact_publisher" = "ZooCodeOrganization"
145+
146+
# Add label to indicate release validation passed
107147
- name: Add changelog-ready label
108148
if: ${{ !contains(github.event.pull_request.labels.*.name, 'changelog-ready') }}
109149
uses: actions/github-script@v7
@@ -117,16 +157,7 @@ jobs:
117157
labels: ['changelog-ready']
118158
});
119159
120-
# Auto-approve PR only after it has been labeled
121160
- name: Auto approve PR
122-
if: contains(github.event.pull_request.labels.*.name, 'changelog-ready')
123161
uses: hmarr/auto-approve-action@v4
124162
with:
125-
review-message: "I'm approving since it's a bump version PR"
126-
127-
# Auto-merge PR
128-
- name: Automerge on PR
129-
if: false # Needs enablePullRequestAutoMerge in repo settings to work contains(github.event.pull_request.labels.*.name, 'changelog-ready')
130-
run: gh pr merge --auto --merge ${{ github.event.pull_request.number }}
131-
env:
132-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
163+
review-message: "Approving the Zoo Code changeset version bump PR after release validation passed"

.roo/commands/release.md

Lines changed: 101 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,107 @@
11
---
2-
description: "Create a new release of the Roo Code extension"
2+
description: "Prepare a new release of the Zoo Code extension"
33
argument-hint: patch | minor | major
44
mode: code
55
---
66

7-
1. Identify the SHA corresponding to the most recent release using GitHub CLI: `gh release view --json tagName,targetCommitish,publishedAt`
8-
2. Analyze changes since the last release using: `gh pr list --state merged --base main --json number,title,author,url,mergedAt,closingIssuesReferences --limit 1000 -q '[.[] | select(.mergedAt > "TIMESTAMP") | {number, title, author: .author.login, url, mergedAt, issues: .closingIssuesReferences}] | sort_by(.number)'`
9-
3. For each PR with linked issues, fetch the issue details to get the issue reporter: `gh issue view ISSUE_NUMBER --json number,author -q '{number, reporter: .author.login}'`
10-
4. Summarize the changes. If the user did not specify, ask them whether this should be a major, minor, or patch release.
11-
5. Create a changeset in .changeset/v[version].md instead of directly modifying package.json. The format is:
7+
1. Identify the most recent stable extension release:
128

13-
```
14-
---
15-
"roo-cline": patch|minor|major
16-
---
17-
[list of changes]
18-
```
19-
20-
- Always include contributor attribution and the PR number: use "(PR #<prNumber> by @username)".
21-
- For PRs that close issues, include both the issue number and the PR number and authors: "- Fix: Description (#123 by @reporter, PR #456 by @contributor)"
22-
- For PRs without linked issues, include the PR number and author: "- Add support for feature (PR #456 by @contributor)"
23-
- Provide brief descriptions of each item to explain the change
24-
- Order the list from most important to least important
25-
- Example formats:
26-
- With issue: "- Fix: Resolve memory leak in extension (#456 by @issueReporter, PR #789 by @prAuthor)"
27-
- Without issue: "- Add support for Gemini 2.5 Pro caching (PR #789 by @contributor)"
28-
- CRITICAL: Include EVERY SINGLE PR in the changeset - don't assume you know which ones are important. Count the total PRs to verify completeness and cross-reference the list to ensure nothing is missed.
29-
30-
6. If the generate_image tool is available, create a release image at `releases/[version]-release.png`
31-
- The image should feature a realistic-looking kangaroo doing something human-like that relates to the main highlight of the release
32-
- Pass `releases/template.png` as the reference image for aspect ratio and kangaroo style
33-
- Add the generated image to .changeset/v[version].md before the list of changes with format: `![X.Y.Z Release - Description](/releases/X.Y.Z-release.png)`
34-
7. If a major or minor release:
35-
- Ask the user what the three most important areas to highlight are in the release
36-
- Update the English version relevant announcement files and documentation (webview-ui/src/components/chat/Announcement.tsx, README.md, and the `latestAnnouncementId` in src/core/webview/ClineProvider.ts)
37-
- Ask the user to confirm that the English version looks good to them before proceeding
38-
- Use the new_task tool to create a subtask in `translate` mode with detailed instructions of which content needs to be translated into all supported languages (The READMEs as well as the translation strings)
39-
8. Create a new branch for the release preparation: `git checkout -b release/v[version]`
40-
9. Commit and push the changeset file and any documentation updates to the repository: `git add . && git commit -m "chore: add changeset for v[version]" && git push origin release/v[version]`
41-
10. Create a pull request for the release: `gh pr create --title "Release v[version]" --body "Release preparation for v[version]. This PR includes the changeset and any necessary documentation updates." --base main --head release/v[version]`
42-
11. The GitHub Actions workflow will automatically:
43-
- Create a version bump PR when changesets are merged to main
44-
- Update the CHANGELOG.md with proper formatting
45-
- Publish the release when the version bump PR is merged
9+
```bash
10+
gh release view --json tagName,targetCommitish,publishedAt
11+
```
12+
13+
2. Analyze changes since that release:
14+
15+
```bash
16+
gh pr list --state merged --base main --json number,title,author,url,mergedAt,closingIssuesReferences --limit 1000 -q '[.[] | select(.mergedAt > "TIMESTAMP") | {number, title, author: .author.login, url, mergedAt, issues: .closingIssuesReferences}] | sort_by(.number)'
17+
```
18+
19+
3. For each PR with linked issues, fetch the issue reporter:
20+
21+
```bash
22+
gh issue view ISSUE_NUMBER --json number,author -q '{number, reporter: .author.login}'
23+
```
24+
25+
4. Summarize the changes. If the user did not specify a release type, ask whether this should be a major, minor, or patch release.
26+
27+
5. Review and update the Marketplace-facing root `README.md`.
28+
29+
- Treat root `README.md` as the source of truth for Marketplace content.
30+
- Update the "What's New" section for the release when appropriate.
31+
- Do not manually edit `src/README.md`; the extension bundle step copies root `README.md` into `src/README.md`.
32+
- Check for stale upstream Roo Code wording that should now say Zoo Code.
33+
34+
6. Create a changeset in `.changeset/v[version].md` instead of directly modifying `src/package.json`. The format is:
35+
36+
```md
37+
---
38+
"zoo-code": patch|minor|major
39+
---
40+
41+
[list of changes]
42+
```
43+
44+
- Always include contributor attribution and the PR number: use `(PR #<prNumber> by @username)`.
45+
- For PRs that close issues, include both issue and PR authors: `- Fix: Description (#123 by @reporter, PR #456 by @contributor)`.
46+
- For PRs without linked issues, include the PR number and author: `- Add support for feature (PR #456 by @contributor)`.
47+
- Provide brief descriptions of each item to explain the change.
48+
- Order the list from most important to least important.
49+
- Include every PR in the release window. Count the PRs and cross-reference the list before creating the PR.
50+
51+
7. If an image generation tool is available, create a release image at `releases/[version]-release.png`.
52+
53+
- The image should relate to the main release highlight and fit the existing release-image style.
54+
- Add the generated image to `.changeset/v[version].md` before the list of changes:
55+
56+
```md
57+
![X.Y.Z Release - Description](/releases/X.Y.Z-release.png)
58+
```
59+
60+
8. For a major or minor release:
61+
62+
- Ask the user what three areas should be highlighted.
63+
- Update relevant announcement files and documentation, including `webview-ui/src/components/chat/Announcement.tsx`, `README.md`, and the `latestAnnouncementId` in `src/core/webview/ClineProvider.ts`.
64+
- Ask the user to confirm the English announcement before proceeding.
65+
- Arrange translation updates for all supported locales affected by README, announcement, or package localization changes.
66+
67+
9. Create and push a release-prep branch:
68+
69+
```bash
70+
git checkout -b release/v[version]
71+
git add .changeset/v[version].md README.md releases/[version]-release.png
72+
git commit -m "chore: add changeset for v[version]"
73+
git push origin release/v[version]
74+
```
75+
76+
Adjust the staged files to match the actual release changes.
77+
78+
10. Create the release-prep PR:
79+
80+
```bash
81+
gh pr create --title "Release v[version]" --body "Release preparation for v[version]. This PR includes the changeset, Marketplace README updates, and any release assets or announcement updates." --base main --head release/v[version]
82+
```
83+
84+
11. After the release-prep PR is merged, GitHub Actions should create a version-bump PR titled `Zoo Code changeset version bump`.
85+
86+
- That PR should update `src/package.json`, `CHANGELOG.md`, `src/CHANGELOG.md`, and remove consumed changesets.
87+
- The validation workflow should verify extension identity, changelog content, README sync, and VSIX packaging.
88+
- The workflow expects these repository settings:
89+
- Variable `RELEASE_APP_ID`: the release GitHub App ID.
90+
- Secret `RELEASE_APP_PRIVATE_KEY`: the release GitHub App private key.
91+
- Variable `RELEASE_BOT_LOGIN`: the PR author login for release bot PRs, currently expected to be `app/roomote`.
92+
- A human should review and merge this version-bump PR.
93+
94+
12. After the version-bump PR is merged, create the release tag on the resulting `main` commit:
95+
96+
```bash
97+
git switch main
98+
git pull origin main
99+
git tag v[version]
100+
git push origin v[version]
101+
```
102+
103+
13. The stable publish workflow runs from the `v[version]` tag.
104+
105+
- Do not create the tag before the version-bump PR is merged.
106+
- The publish workflow validates that the tag version matches `src/package.json`.
107+
- Marketplace and Open VSX publishing use the configured CI secrets.

0 commit comments

Comments
 (0)