Skip to content

Commit 4b54458

Browse files
cursoragenthuylg
andcommitted
Publish VSIX assets to GitHub Releases
Co-authored-by: Huy Ly <huylg@users.noreply.github.com>
1 parent ef1630b commit 4b54458

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

.github/workflows/build-vsix.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
build-vsix:
1010
runs-on: ubuntu-latest
1111
permissions:
12-
contents: read
12+
contents: write
1313

1414
steps:
1515
- name: Check out repository
@@ -27,12 +27,28 @@ jobs:
2727
- name: Compile extension
2828
run: npm run compile
2929

30+
- name: Set VSIX output name
31+
run: |
32+
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
33+
echo "VSIX_PATH=open-command-${GITHUB_REF_NAME}.vsix" >> "$GITHUB_ENV"
34+
else
35+
echo "VSIX_PATH=open-command.vsix" >> "$GITHUB_ENV"
36+
fi
37+
3038
- name: Package VSIX
31-
run: npm run package:vsix -- --out open-command.vsix
39+
run: npm run package:vsix -- --out "${VSIX_PATH}"
3240

3341
- name: Upload VSIX artifact
3442
uses: actions/upload-artifact@v4
3543
with:
3644
name: open-command-vsix
37-
path: open-command.vsix
45+
path: ${{ env.VSIX_PATH }}
3846
if-no-files-found: error
47+
48+
- name: Publish VSIX to GitHub Releases
49+
if: github.ref_type == 'tag'
50+
uses: softprops/action-gh-release@v2
51+
with:
52+
files: ${{ env.VSIX_PATH }}
53+
fail_on_unmatched_files: true
54+
generate_release_notes: true

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ cursor --install-extension open-command-*.vsix
5757

5858
GitHub Actions builds the extension on every push, pull request, and manual run, then uploads the generated `.vsix` as a workflow artifact.
5959

60+
When the workflow runs for a Git tag, it also publishes the `.vsix` file to GitHub Releases as a release asset. Push a version tag such as `v0.0.1` to create a release build.
61+
6062
## License
6163

6264
MIT

0 commit comments

Comments
 (0)