Skip to content

Commit 5a39886

Browse files
committed
Add GitHub release workflow for VS Code extension
1 parent e06d2e2 commit 5a39886

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Create GitHub Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'apps/editor/package.json'
9+
10+
# Required to allow the workflow to create tags and releases
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Get version from package.json
23+
id: package_version
24+
run: |
25+
VERSION=$(jq -r .version apps/editor/package.json)
26+
echo "version=v$VERSION" >> $GITHUB_OUTPUT
27+
28+
- name: Check if tag exists
29+
id: check_tag
30+
run: |
31+
# Prevent failing if package.json was modified but version wasn't bumped
32+
if git ls-remote --tags origin refs/tags/${{ steps.package_version.outputs.version }} | grep -q 'refs/tags/'; then
33+
echo "exists=true" >> $GITHUB_OUTPUT
34+
else
35+
echo "exists=false" >> $GITHUB_OUTPUT
36+
fi
37+
38+
- name: Setup Node.js
39+
if: steps.check_tag.outputs.exists == 'false'
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: '20'
43+
44+
- name: Setup PNPM
45+
if: steps.check_tag.outputs.exists == 'false'
46+
uses: pnpm/action-setup@v2
47+
with:
48+
version: 9.6.0
49+
run_install: false
50+
51+
- name: Install dependencies
52+
if: steps.check_tag.outputs.exists == 'false'
53+
run: pnpm i
54+
55+
- name: Build VS Code extension
56+
if: steps.check_tag.outputs.exists == 'false'
57+
run: |
58+
cd apps/editor
59+
pnpm build
60+
61+
- name: Create Release and Upload VSIX
62+
if: steps.check_tag.outputs.exists == 'false'
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
tag_name: ${{ steps.package_version.outputs.version }}
66+
name: Release ${{ steps.package_version.outputs.version }}
67+
generate_release_notes: true
68+
# Grab the compiled .vsix generated by 'vsce package'
69+
files: apps/editor/*.vsix

0 commit comments

Comments
 (0)