Skip to content

Commit 505423f

Browse files
infra(ide): add deployment pipeline for ide package (#103)
* infra(ide): add deployment pipeline for ide package * fix naming for release ide script
1 parent 519bb77 commit 505423f

File tree

3 files changed

+135
-1
lines changed

3 files changed

+135
-1
lines changed

.github/workflows/release-ide.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: Release IDE Extensions
2+
3+
on:
4+
push:
5+
tags:
6+
- "ide-v*.*.*"
7+
workflow_dispatch:
8+
inputs:
9+
dry-run:
10+
description: "Dry run (don't actually publish)"
11+
required: false
12+
type: boolean
13+
default: false
14+
15+
jobs:
16+
release:
17+
name: Build and Publish IDE Extensions
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Extract version from tag
27+
id: version
28+
run: |
29+
if [[ "${{ github.event_name }}" == "push" ]]; then
30+
# Extract version from tag (ide-v1.2.3 -> 1.2.3)
31+
VERSION="${GITHUB_REF#refs/tags/ide-v}"
32+
else
33+
# For manual trigger, read from package.json
34+
VERSION=$(jq -r .version packages/vscode/package.json)
35+
fi
36+
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
echo "Extracted version: $VERSION"
38+
39+
- name: Verify tag version matches package.json
40+
if: ${{ github.event_name == 'push' }}
41+
run: |
42+
PKG_VERSION=$(jq -r .version packages/vscode/package.json)
43+
TAG_VERSION="${{ steps.version.outputs.version }}"
44+
if [[ "$PKG_VERSION" != "$TAG_VERSION" ]]; then
45+
echo "Error: Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
46+
echo "The tag must match the committed version. Ensure you've merged the Version Packages PR first."
47+
exit 1
48+
fi
49+
echo "Version verified: $PKG_VERSION"
50+
51+
- name: Log manual run version source
52+
if: ${{ github.event_name == 'workflow_dispatch' }}
53+
run: |
54+
VERSION=$(jq -r .version packages/vscode/package.json)
55+
echo "Manual run uses package.json version: $VERSION"
56+
57+
- name: Setup Bun
58+
uses: oven-sh/setup-bun@v2
59+
with:
60+
bun-version-file: package.json
61+
62+
- name: Setup Node.js
63+
uses: actions/setup-node@v4
64+
with:
65+
node-version: "20"
66+
67+
- name: Install dependencies
68+
run: bun install --frozen-lockfile
69+
70+
- name: Build VS Code extension
71+
run: bunx turbo run build --filter=t-req-vscode...
72+
73+
- name: Run VS Code unit tests
74+
run: bun run --cwd packages/vscode test:unit
75+
76+
- name: Run VS Code integration tests
77+
run: xvfb-run -a bun run --cwd packages/vscode test:integration
78+
79+
- name: Package VSIX
80+
id: package
81+
working-directory: packages/vscode
82+
run: |
83+
VERSION="${{ steps.version.outputs.version }}"
84+
VSIX_NAME="t-req-vscode-${VERSION}.vsix"
85+
bunx @vscode/vsce package --no-dependencies --out "$VSIX_NAME"
86+
SHA256=$(sha256sum "$VSIX_NAME" | awk '{print $1}')
87+
echo "vsix_name=$VSIX_NAME" >> "$GITHUB_OUTPUT"
88+
echo "sha256=$SHA256" >> "$GITHUB_OUTPUT"
89+
echo "Created $VSIX_NAME"
90+
echo "SHA256: $SHA256"
91+
92+
- name: Upload VSIX artifact
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: t-req-ide-vsix
96+
path: packages/vscode/${{ steps.package.outputs.vsix_name }}
97+
98+
- name: Publish to VS Code Marketplace
99+
if: ${{ github.event_name == 'push' || !inputs.dry-run }}
100+
working-directory: packages/vscode
101+
env:
102+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
103+
run: |
104+
if [[ -z "$VSCE_PAT" ]]; then
105+
echo "Missing VSCE_PAT secret"
106+
exit 1
107+
fi
108+
bunx @vscode/vsce publish --packagePath "${{ steps.package.outputs.vsix_name }}" --pat "$VSCE_PAT"
109+
110+
- name: Publish to Cursor (OpenVSX)
111+
if: ${{ github.event_name == 'push' || !inputs.dry-run }}
112+
working-directory: packages/vscode
113+
env:
114+
OVSX_TOKEN: ${{ secrets.OVSX_TOKEN }}
115+
run: |
116+
if [[ -z "$OVSX_TOKEN" ]]; then
117+
echo "Missing OVSX_TOKEN secret"
118+
exit 1
119+
fi
120+
bunx ovsx publish "${{ steps.package.outputs.vsix_name }}" -p "$OVSX_TOKEN"
121+
122+
- name: Dry run summary
123+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.dry-run }}
124+
run: |
125+
echo "=== DRY RUN SUMMARY ==="
126+
echo "Version: ${{ steps.version.outputs.version }}"
127+
echo "VSIX: packages/vscode/${{ steps.package.outputs.vsix_name }}"
128+
echo "SHA256: ${{ steps.package.outputs.sha256 }}"
129+
echo ""
130+
echo "[dry-run] Would publish to VS Code Marketplace"
131+
echo "[dry-run] Would publish to Cursor (OpenVSX)"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"release:app": "bun run script/release.ts --package app",
1818
"release:core": "bun run script/release.ts --package core",
1919
"release:sdk": "bun run script/release.ts --package sdk",
20+
"release:ide": "bun run script/release.ts --package ide",
2021
"release:plugin-base": "bun run script/release.ts --package plugin-base",
2122
"release:plugin-assert": "bun run script/release.ts --package plugin-assert",
2223
"sst:dev": "sst dev",

script/release.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const PACKAGES: Record<string, PackageConfig> = {
3131
core: { path: 'packages/core', tagPrefix: 'core-v' },
3232
app: { path: 'packages/app', tagPrefix: 'app-v' },
3333
sdk: { path: 'packages/sdk/js', tagPrefix: 'sdk-v' },
34+
ide: { path: 'packages/vscode', tagPrefix: 'ide-v' },
3435
'plugin-base': { path: 'packages/plugins/base', tagPrefix: 'plugin-base-v' },
3536
'plugin-assert': { path: 'packages/plugins/assert', tagPrefix: 'plugin-assert-v' }
3637
};
@@ -75,14 +76,15 @@ function printHelp(): void {
7576
Usage: bun run script/release.ts [options]
7677
7778
Options:
78-
--package, -p <name> Package to release (core, app, sdk, plugin-base, plugin-assert). Can be specified multiple times.
79+
--package, -p <name> Package to release (core, app, sdk, ide, plugin-base, plugin-assert). Can be specified multiple times.
7980
--dry-run, -n Show what would be done without making changes
8081
--help, -h Show this help message
8182
8283
Examples:
8384
bun run script/release.ts --package core
8485
bun run script/release.ts --package app --dry-run
8586
bun run script/release.ts --package sdk
87+
bun run script/release.ts --package ide
8688
bun run script/release.ts --package plugin-base
8789
bun run script/release.ts --package plugin-assert
8890
bun run script/release.ts --package core --package app

0 commit comments

Comments
 (0)