Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit a442468

Browse files
committed
feat(ci): add stable and prerelease marketplace publishing
1 parent ecb4720 commit a442468

6 files changed

Lines changed: 133 additions & 100 deletions

File tree

Lines changed: 84 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,109 @@
1-
name: Publish Extension
1+
name: Publish Stable Extension
22

33
on:
4-
pull_request:
5-
types: [closed]
4+
push:
5+
tags:
6+
- "v*.*.*"
67
workflow_dispatch:
78

8-
env:
9-
GIT_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || 'main' }}
10-
119
jobs:
12-
publish-extension:
10+
publish-stable:
1311
runs-on: ubuntu-latest
1412
permissions:
15-
contents: write # Required for pushing tags.
16-
if: >
17-
( github.event_name == 'pull_request' &&
18-
github.event.pull_request.base.ref == 'main' &&
19-
contains(github.event.pull_request.title, 'Changeset version bump') ) ||
20-
github.event_name == 'workflow_dispatch'
13+
contents: write
14+
2115
steps:
2216
- name: Checkout code
2317
uses: actions/checkout@v4
24-
with:
25-
ref: ${{ env.GIT_REF }}
18+
2619
- name: Setup Node.js and pnpm
2720
uses: ./.github/actions/setup-node-pnpm
28-
- name: Configure Git
21+
with:
22+
install-args: "--frozen-lockfile"
23+
24+
- name: Validate package identity
2925
run: |
30-
git config user.name "github-actions[bot]"
31-
git config user.email "github-actions[bot]@users.noreply.github.com"
32-
- name: Create .env file
33-
run: echo "POSTHOG_API_KEY=${{ secrets.POSTHOG_API_KEY }}" >> .env
34-
- name: Package Extension
26+
package_name=$(node -p "require('./src/package.json').name")
27+
publisher=$(node -p "require('./src/package.json').publisher")
28+
29+
test "$package_name" = "zoo-code"
30+
test "$publisher" = "ZooCodeOrganization"
31+
32+
- name: Validate release tag
33+
if: github.event_name == 'push'
3534
run: |
36-
current_package_version=$(node -p "require('./src/package.json').version")
37-
pnpm vsix
38-
39-
# Save VSIX contents to a temporary file to avoid broken pipe issues.
40-
unzip -l bin/roo-cline-${current_package_version}.vsix > /tmp/roo-code-vsix-contents.txt
41-
42-
# Check for required files.
43-
grep -q "extension/package.json" /tmp/roo-code-vsix-contents.txt || exit 1
44-
grep -q "extension/package.nls.json" /tmp/roo-code-vsix-contents.txt || exit 1
45-
grep -q "extension/dist/extension.js" /tmp/roo-code-vsix-contents.txt || exit 1
46-
grep -q "extension/webview-ui/audio/celebration.wav" /tmp/roo-code-vsix-contents.txt || exit 1
47-
grep -q "extension/webview-ui/build/assets/index.js" /tmp/roo-code-vsix-contents.txt || exit 1
48-
grep -q "extension/assets/codicons/codicon.ttf" /tmp/roo-code-vsix-contents.txt || exit 1
49-
grep -q "extension/assets/vscode-material-icons/icons/3d.svg" /tmp/roo-code-vsix-contents.txt || exit 1
50-
grep -q ".env" /tmp/roo-code-vsix-contents.txt || exit 1
51-
52-
# Clean up temporary file.
53-
rm /tmp/roo-code-vsix-contents.txt
54-
- name: Create and Push Git Tag
35+
package_version=$(node -p "require('./src/package.json').version")
36+
tag_version="${GITHUB_REF_NAME#v}"
37+
38+
if [ "$package_version" != "$tag_version" ]; then
39+
echo "Tag v${tag_version} does not match src/package.json version ${package_version}."
40+
exit 1
41+
fi
42+
43+
- name: Package extension
44+
env:
45+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
5546
run: |
56-
current_package_version=$(node -p "require('./src/package.json').version")
57-
git tag -a "v${current_package_version}" -m "Release v${current_package_version}"
58-
git push origin "v${current_package_version}" --no-verify
59-
echo "Successfully created and pushed git tag v${current_package_version}"
60-
- name: Publish Extension
47+
package_version=$(node -p "require('./src/package.json').version")
48+
pnpm --filter ./src vsix
49+
50+
vsix_path="bin/zoo-code-${package_version}.vsix"
51+
test -f "$vsix_path"
52+
53+
unzip -l "$vsix_path" > /tmp/zoo-code-vsix-contents.txt
54+
grep -q "extension/package.json" /tmp/zoo-code-vsix-contents.txt
55+
grep -q "extension/package.nls.json" /tmp/zoo-code-vsix-contents.txt
56+
grep -q "extension/dist/extension.js" /tmp/zoo-code-vsix-contents.txt
57+
grep -q "extension/webview-ui/audio/celebration.wav" /tmp/zoo-code-vsix-contents.txt
58+
grep -q "extension/webview-ui/build/assets/index.js" /tmp/zoo-code-vsix-contents.txt
59+
grep -q "extension/assets/codicons/codicon.ttf" /tmp/zoo-code-vsix-contents.txt
60+
grep -q "extension/assets/vscode-material-icons/icons/3d.svg" /tmp/zoo-code-vsix-contents.txt
61+
62+
- name: Publish to VS Code Marketplace
6163
env:
6264
VSCE_PAT: ${{ secrets.VSCE_PAT }}
63-
OVSX_PAT: ${{ secrets.OVSX_PAT }}
6465
run: |
65-
current_package_version=$(node -p "require('./src/package.json').version")
66-
pnpm --filter roo-cline publish:marketplace
67-
echo "Successfully published version $current_package_version to VS Code Marketplace"
68-
- name: Create GitHub Release
66+
package_version=$(node -p "require('./src/package.json').version")
67+
npx @vscode/vsce publish --packagePath "bin/zoo-code-${package_version}.vsix"
68+
echo "Published ZooCodeOrganization.zoo-code ${package_version} to VS Code Marketplace"
69+
70+
- name: Publish to Open VSX Registry
6971
env:
70-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
OVSX_PAT: ${{ secrets.OVSX_PAT }}
7173
run: |
72-
current_package_version=$(node -p "require('./src/package.json').version")
74+
package_version=$(node -p "require('./src/package.json').version")
75+
pnpm exec ovsx publish "bin/zoo-code-${package_version}.vsix" --skip-duplicate
76+
echo "Published ZooCodeOrganization.zoo-code ${package_version} to Open VSX Registry"
7377
74-
# Extract changelog for current version
75-
echo "Extracting changelog for version ${current_package_version}"
76-
changelog_content=$(sed -n "/## \\[${current_package_version}\\]/,/## \\[/p" CHANGELOG.md | sed '$d')
78+
- name: Create GitHub release
79+
env:
80+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
run: |
82+
package_version=$(node -p "require('./src/package.json').version")
83+
if [ "${GITHUB_REF_TYPE:-}" = "tag" ]; then
84+
tag_name="$GITHUB_REF_NAME"
85+
else
86+
tag_name="v${package_version}"
87+
fi
88+
vsix_path="bin/zoo-code-${package_version}.vsix"
7789
78-
# If changelog extraction failed, use a default message
90+
changelog_content=$(awk -v version="$package_version" '
91+
$0 ~ "^## \\[" version "\\]" { found = 1 }
92+
found && $0 == "---" { exit }
93+
found && $0 ~ "^## " && $0 !~ "^## \\[" version "\\]" { exit }
94+
found { print }
95+
' CHANGELOG.md)
7996
if [ -z "$changelog_content" ]; then
80-
echo "Warning: No changelog section found for version ${current_package_version}"
81-
changelog_content="Release v${current_package_version}"
82-
else
83-
echo "Found changelog section for version ${current_package_version}"
97+
changelog_content="Release ${tag_name}"
8498
fi
99+
printf "%s\n" "$changelog_content" > /tmp/zoo-code-release-notes.md
85100
86-
# Create release with changelog content
87-
gh release create "v${current_package_version}" \
88-
--title "Release v${current_package_version}" \
89-
--notes "$changelog_content" \
90-
--target ${{ env.GIT_REF }} \
91-
bin/roo-cline-${current_package_version}.vsix
92-
echo "Successfully created GitHub Release v${current_package_version}"
101+
if gh release view "$tag_name" >/dev/null 2>&1; then
102+
gh release upload "$tag_name" "$vsix_path" --clobber
103+
else
104+
gh release create "$tag_name" \
105+
--title "Zoo Code ${tag_name}" \
106+
--notes-file /tmp/zoo-code-release-notes.md \
107+
--target "$GITHUB_SHA" \
108+
"$vsix_path"
109+
fi
Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,71 @@
1-
name: Nightly Publish
1+
name: Publish Pre-release Extension
22

33
on:
44
push:
55
branches: [main]
66
workflow_dispatch: # Allows manual triggering.
77

8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: marketplace-prerelease
13+
cancel-in-progress: false
14+
815
jobs:
9-
publish-nightly:
16+
publish-prerelease:
1017
runs-on: ubuntu-latest
1118

12-
permissions:
13-
contents: read # No tags pushed → read is enough.
14-
1519
steps:
1620
- name: Checkout code
1721
uses: actions/checkout@v4
1822
with:
1923
fetch-depth: 0
24+
2025
- name: Setup Node.js and pnpm
2126
uses: ./.github/actions/setup-node-pnpm
2227
with:
23-
install-args: '--frozen-lockfile'
24-
- name: Forge numeric Nightly version
28+
install-args: "--frozen-lockfile"
29+
30+
- name: Validate package identity
31+
run: |
32+
package_name=$(node -p "require('./src/package.json').name")
33+
publisher=$(node -p "require('./src/package.json').publisher")
34+
35+
test "$package_name" = "zoo-code"
36+
test "$publisher" = "ZooCodeOrganization"
37+
38+
- name: Set pre-release version
2539
id: version
2640
env:
2741
RUN_NUMBER: ${{ github.run_number }}
28-
run: echo "number=$(( 5500 + ${RUN_NUMBER} ))" >> $GITHUB_OUTPUT
29-
- name: Patch package.json version
30-
env:
31-
VERSION_NUMBER: ${{ steps.version.outputs.number }}
3242
run: |
3343
node <<'EOF'
34-
const fs = require('fs');
35-
const path = require('path');
36-
const pkgPath = path.join(__dirname, 'apps', 'vscode-nightly', 'package.nightly.json');
37-
const pkg = JSON.parse(fs.readFileSync(pkgPath,'utf8'));
38-
const [maj, min] = pkg.version.split('.');
39-
pkg.version = `${maj}.${min}.${process.env.VERSION_NUMBER}`;
40-
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2));
41-
console.log(`🔖 Nightly version set to ${pkg.version}`);
44+
const fs = require("fs")
45+
const pkgPath = "src/package.json"
46+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"))
47+
const [major, minor] = pkg.version.split(".").map(Number)
48+
const prereleaseMinor = minor % 2 === 0 ? minor + 1 : minor
49+
const patch = 100000 + Number(process.env.RUN_NUMBER)
50+
51+
pkg.version = `${major}.${prereleaseMinor}.${patch}`
52+
fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, "\t")}\n`)
53+
fs.appendFileSync(process.env.GITHUB_OUTPUT, `number=${pkg.version}\n`)
54+
console.log(`Pre-release version set to ${pkg.version}`)
4255
EOF
43-
- name: Build VSIX
44-
run: pnpm vsix:nightly # Produces bin/roo-code-nightly-0.0.[count].vsix
45-
- name: Publish to VS Code Marketplace
56+
57+
- name: Package pre-release VSIX
4658
env:
47-
VSCE_PAT: ${{ secrets.VSCE_PAT }}
48-
run: npx vsce publish --packagePath "bin/$(/bin/ls bin | head -n1)"
49-
- name: Publish to Open VSX Registry
59+
POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
60+
PKG_RELEASE_CHANNEL: prerelease
61+
run: |
62+
pnpm --filter ./src bundle --production
63+
npx @vscode/vsce package --pre-release --no-dependencies --cwd src --out ../bin
64+
65+
- name: Publish pre-release to VS Code Marketplace
5066
env:
51-
OVSX_PAT: ${{ secrets.OVSX_PAT }}
52-
run: npx ovsx publish "bin/$(ls bin | head -n1)"
67+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
68+
VERSION_NUMBER: ${{ steps.version.outputs.number }}
69+
run: |
70+
npx @vscode/vsce publish --pre-release --packagePath "bin/zoo-code-${VERSION_NUMBER}.vsix"
71+
echo "Published ZooCodeOrganization.zoo-code ${VERSION_NUMBER} as a VS Code Marketplace pre-release"

apps/cli/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ For contributing or development:
6262
pnpm install
6363

6464
# Build the main extension first.
65-
pnpm --filter roo-cline bundle
65+
pnpm --filter ./src bundle
6666

6767
# Build the CLI.
6868
pnpm --filter @roo-code/cli build

apps/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"test": "vitest run",
1616
"test:integration": "tsx scripts/integration/run.ts",
1717
"build": "tsup",
18-
"build:extension": "pnpm --filter roo-cline bundle",
18+
"build:extension": "pnpm --filter ./src bundle",
1919
"dev": "ROO_AUTH_BASE_URL=https://app.roocode.com ROO_SDK_BASE_URL=https://cloud-api.roocode.com ROO_CODE_PROVIDER_URL=https://api.roocode.com/proxy tsx src/index.ts",
2020
"dev:local": "ROO_AUTH_BASE_URL=http://localhost:3000 ROO_SDK_BASE_URL=http://localhost:3001 ROO_CODE_PROVIDER_URL=http://localhost:8080/proxy tsx src/index.ts",
2121
"clean": "rimraf dist .turbo"

packages/evals/Dockerfile.runner

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ RUN pnpm vsix -- --out ../bin/roo-code.vsix \
163163

164164
# Build the extension bundle and CLI (for CLI execution method)
165165
# The CLI requires the extension bundle (src/dist/extension.js) and the CLI build (apps/cli/dist/index.js)
166-
RUN pnpm --filter roo-cline bundle \
166+
RUN pnpm --filter ./src bundle \
167167
&& pnpm --filter @roo-code/cli build
168168

169169
# Copy entrypoint script

src/.vscodeignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,3 @@
3131
!assets/vscode-material-icons/**
3232
!assets/icons/**
3333
!assets/images/**
34-
35-
# Include .env file for telemetry
36-
!.env

0 commit comments

Comments
 (0)