Skip to content

Commit 0b25ea4

Browse files
Copilothotlong
andcommitted
feat(vscode): add VSCode extension publishing workflow
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 14bfb1a commit 0b25ea4

File tree

10 files changed

+428
-33
lines changed

10 files changed

+428
-33
lines changed

.github/WORKFLOWS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,17 @@ This document describes all the GitHub Actions workflows configured for the Obje
5050
- Reminds contributors to add changesets
5151
- Comments on PRs with changelog preview
5252

53+
### 📦 [publish-vscode-extension.yml](workflows/publish-vscode-extension.yml) ✨ NEW
54+
**Purpose:** Publish VSCode extension to marketplace
55+
**Triggers:** Manual dispatch, Git tags (`vscode-v*.*.*`)
56+
**What it does:**
57+
- Builds the ObjectQL VSCode extension
58+
- Packages the extension as `.vsix` file
59+
- Publishes to VSCode Marketplace (requires VSCE_PAT secret)
60+
- Creates GitHub Release with VSIX artifact
61+
- Supports dry-run mode for testing
62+
- See [PUBLISHING.md](../packages/tools/vscode-objectql/PUBLISHING.md) for detailed instructions
63+
5364
## Code Quality & Security
5465

5566
### 🔒 [codeql.yml](workflows/codeql.yml)
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Publish VSCode Extension
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to publish (leave empty to use version from package.json)'
8+
required: false
9+
type: string
10+
dry_run:
11+
description: 'Dry run (package only, do not publish)'
12+
required: false
13+
type: boolean
14+
default: false
15+
push:
16+
tags:
17+
- 'vscode-v*.*.*'
18+
19+
permissions:
20+
contents: write
21+
issues: write
22+
pull-requests: write
23+
24+
jobs:
25+
publish:
26+
name: Package and Publish VSCode Extension
27+
runs-on: ubuntu-latest
28+
timeout-minutes: 15
29+
30+
steps:
31+
- name: Checkout Repository
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 20
38+
39+
- name: Install pnpm
40+
uses: pnpm/action-setup@v3
41+
with:
42+
version: 10
43+
run_install: false
44+
45+
- name: Get pnpm store directory
46+
shell: bash
47+
run: |
48+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
49+
50+
- name: Setup pnpm cache
51+
uses: actions/cache@v4
52+
with:
53+
path: ${{ env.STORE_PATH }}
54+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
55+
restore-keys: |
56+
${{ runner.os }}-pnpm-store-
57+
58+
- name: Install Dependencies
59+
run: pnpm install
60+
timeout-minutes: 3
61+
62+
- name: Build Monorepo
63+
run: pnpm run build
64+
timeout-minutes: 5
65+
66+
- name: Build VSCode Extension
67+
working-directory: packages/tools/vscode-objectql
68+
run: pnpm run compile
69+
70+
- name: Update Version (if specified)
71+
if: inputs.version != ''
72+
working-directory: packages/tools/vscode-objectql
73+
run: |
74+
echo "Updating version to ${{ inputs.version }}"
75+
npm version ${{ inputs.version }} --no-git-tag-version
76+
77+
- name: Package Extension
78+
working-directory: packages/tools/vscode-objectql
79+
run: |
80+
npx @vscode/vsce package --no-yarn
81+
echo "VSIX_FILE=$(ls *.vsix)" >> $GITHUB_ENV
82+
83+
- name: Upload VSIX as Artifact
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: vscode-objectql-extension
87+
path: packages/tools/vscode-objectql/*.vsix
88+
retention-days: 30
89+
90+
- name: Publish to VSCode Marketplace
91+
if: inputs.dry_run != true
92+
working-directory: packages/tools/vscode-objectql
93+
env:
94+
VSCE_PAT: ${{ secrets.VSCE_PAT }}
95+
run: |
96+
if [ -z "$VSCE_PAT" ]; then
97+
echo "::error::VSCE_PAT secret is not set. Cannot publish to marketplace."
98+
exit 1
99+
fi
100+
npx @vscode/vsce publish --no-yarn --pat "$VSCE_PAT"
101+
102+
- name: Create GitHub Release
103+
if: inputs.dry_run != true && startsWith(github.ref, 'refs/tags/')
104+
uses: softprops/action-gh-release@v1
105+
with:
106+
files: packages/tools/vscode-objectql/*.vsix
107+
generate_release_notes: true
108+
draft: false
109+
prerelease: false
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
113+
- name: Summary
114+
run: |
115+
echo "## 🎉 VSCode Extension Build Complete" >> $GITHUB_STEP_SUMMARY
116+
echo "" >> $GITHUB_STEP_SUMMARY
117+
echo "### Package Details" >> $GITHUB_STEP_SUMMARY
118+
echo "- **VSIX File:** \`${{ env.VSIX_FILE }}\`" >> $GITHUB_STEP_SUMMARY
119+
echo "- **Dry Run:** ${{ inputs.dry_run }}" >> $GITHUB_STEP_SUMMARY
120+
if [ "${{ inputs.dry_run }}" == "true" ]; then
121+
echo "- **Status:** ✅ Packaged (not published)" >> $GITHUB_STEP_SUMMARY
122+
else
123+
echo "- **Status:** ✅ Published to VSCode Marketplace" >> $GITHUB_STEP_SUMMARY
124+
fi
125+
echo "" >> $GITHUB_STEP_SUMMARY
126+
echo "### Next Steps" >> $GITHUB_STEP_SUMMARY
127+
if [ "${{ inputs.dry_run }}" == "true" ]; then
128+
echo "- Download the VSIX artifact to test locally" >> $GITHUB_STEP_SUMMARY
129+
echo "- Install in VSCode: Extensions → Install from VSIX" >> $GITHUB_STEP_SUMMARY
130+
else
131+
echo "- Extension is now available in VSCode Marketplace" >> $GITHUB_STEP_SUMMARY
132+
echo "- Search for 'ObjectQL' in VSCode Extensions" >> $GITHUB_STEP_SUMMARY
133+
fi

packages/tools/vscode-objectql/.vscodeignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ src/**
44
.gitignore
55
.vscodeignore
66
tsconfig.json
7+
tsconfig.tsbuildinfo
78
test-workspace/**
89
node_modules/**
910
*.vsix
11+
CONTRIBUTING.md
12+
IMPLEMENTATION-SUMMARY.md
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 ObjectQL Contributors (https://github.com/objectql)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)