Skip to content

Commit 746bc6a

Browse files
committed
Add GitHub Actions workflows for building and publishing the extension
- Introduced a new workflow for building the extension package on the 'extension_test' branch. - Updated the publish workflow to include steps for retrieving package info and uploading the VSIX artifact with a longer retention period. - Enhanced the publish workflow name for clarity regarding its purpose.
1 parent a530029 commit 746bc6a

2 files changed

Lines changed: 79 additions & 1 deletion

File tree

.github/workflows/build.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Build Extension Package
2+
3+
on:
4+
push:
5+
branches:
6+
- extension_test
7+
pull_request:
8+
branches:
9+
- extension_test
10+
workflow_dispatch: # Allow manual trigger
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Compile
29+
run: npm run compile
30+
31+
- name: Install vsce
32+
run: npm install -g @vscode/vsce
33+
34+
- name: Package Extension
35+
run: vsce package
36+
37+
- name: Upload VSIX as artifact
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: extension
41+
path: "*.vsix"
42+
retention-days: 5
43+
44+
- name: Get Package Info
45+
id: package
46+
run: |
47+
VSIX_PATH=$(ls *.vsix)
48+
echo "Package created: $VSIX_PATH"
49+
echo "vsix_path=$VSIX_PATH" >> $GITHUB_OUTPUT
50+
51+
- name: Add Comment to PR
52+
if: github.event_name == 'pull_request'
53+
uses: actions/github-script@v7
54+
with:
55+
script: |
56+
const vsixPath = '${{ steps.package.outputs.vsix_path }}';
57+
const message = `✨ Extension package built successfully!\nArtifact: \`${vsixPath}\`\n\nYou can download the VSIX package from the Actions tab.`;
58+
59+
github.rest.issues.createComment({
60+
owner: context.repo.owner,
61+
repo: context.repo.repo,
62+
issue_number: context.issue.number,
63+
body: message
64+
});

.github/workflows/publish.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Extension
1+
name: Publish Extension to Visual Studio Marketplace
22

33
on:
44
push:
@@ -32,5 +32,19 @@ jobs:
3232
- name: Package Extension
3333
run: vsce package
3434

35+
- name: Get Package Info
36+
id: package
37+
run: |
38+
VSIX_PATH=$(ls *.vsix)
39+
echo "Package created: $VSIX_PATH"
40+
echo "vsix_path=$VSIX_PATH" >> $GITHUB_OUTPUT
41+
42+
- name: Upload VSIX as artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: extension-release
46+
path: "*.vsix"
47+
retention-days: 400 # Maximum retention period allowed by GitHub
48+
3549
- name: Publish to Visual Studio Marketplace
3650
run: vsce publish -p "${{ secrets.VSC_PAT }}"

0 commit comments

Comments
 (0)