Skip to content

Commit d692064

Browse files
EndlessTraxCopilot
andauthored
Add release workflow for automatic marketplace publishing (#9)
* Add GitHub Actions workflow for automatic marketplace publishing on tags * Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Add @vscode/vsce as dev dependency and use npx in workflow * Add missing npx * Fix version in gh release * Update .github/workflows/release.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 04acfb8 commit d692064

File tree

3 files changed

+3958
-2
lines changed

3 files changed

+3958
-2
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release Extension
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
cache: 'npm'
23+
24+
- name: Install dependencies
25+
run: npm install
26+
27+
- name: Get version from tag
28+
id: get_version
29+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
30+
31+
- name: Verify version matches package.json
32+
run: |
33+
PACKAGE_VERSION=$(node -p "require('./package.json').version")
34+
TAG_VERSION="${{ steps.get_version.outputs.VERSION }}"
35+
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
36+
echo "Error: package.json version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
37+
exit 1
38+
fi
39+
40+
- name: Package extension
41+
run: npx vsce package
42+
43+
- name: Publish to VS Code Marketplace
44+
run: npx vsce publish
45+
env:
46+
VSCE_PAT: ${{ secrets.MARKETPLACE_TOKEN }}
47+
48+
- name: Create GitHub Release
49+
run: |
50+
gh release create ${{ github.ref_name }} \
51+
--title "Release ${{ github.ref_name }}" \
52+
--generate-notes \
53+
*.vsix
54+
env:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)