Skip to content

Commit 71e196f

Browse files
committed
ci: enhance GitHub Actions workflow for publishing to Open VSX registry
1 parent 5cca9aa commit 71e196f

File tree

1 file changed

+45
-21
lines changed

1 file changed

+45
-21
lines changed

.github/workflows/main.yml

Lines changed: 45 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,54 +6,78 @@ on:
66
tags: ['v*']
77
pull_request:
88
branches: [main]
9-
9+
release:
10+
types:
11+
- published
1012
jobs:
1113
build:
1214
strategy:
1315
matrix:
1416
os: [ubuntu-latest, macos-latest]
1517
runs-on: ${{ matrix.os }}
18+
outputs:
19+
vsixPath: ${{ steps.packageExtension.outputs.vsixPath }}
1620
steps:
1721
- name: Checkout
18-
uses: actions/checkout@v3
19-
22+
uses: actions/checkout@v6
2023
- name: Install Node.js
21-
uses: actions/setup-node@v3
24+
uses: actions/setup-node@v6
2225
with:
2326
node-version: 22
24-
2527
- name: Install dependencies
26-
run: npm install
27-
28+
run: npm ci
2829
- name: Run lint
2930
run: npm run lint
30-
3131
- name: Run tests
3232
run: npm test
3333
if: runner.os == 'macOS'
34-
3534
- name: Run tests (Linux)
3635
run: xvfb-run -a npm test
3736
if: runner.os == 'Linux'
38-
39-
- name: Package extension
40-
run: npx vsce package
37+
- name: Package Extension
38+
id: packageExtension
39+
uses: HaaLeo/publish-vscode-extension@v2
40+
with:
41+
pat: stub
42+
dryRun: true
43+
- name: Upload Extension Package as Artifact
44+
uses: actions/upload-artifact@v7
45+
with:
46+
name: ${{ matrix.os }}
47+
path: ${{ steps.packageExtension.outputs.vsixPath }}
4148

4249
publish:
4350
runs-on: ubuntu-latest
4451
needs: build
45-
if: success() && startsWith(github.ref, 'refs/tags/')
52+
if: github.event_name == 'release'
4653
steps:
4754
- name: Checkout
48-
uses: actions/checkout@v3
49-
55+
uses: actions/checkout@v6
5056
- name: Install Node.js
51-
uses: actions/setup-node@v3
57+
uses: actions/setup-node@v6
5258
with:
5359
node-version: 22
54-
5560
- name: Install dependencies
56-
run: npm install
57-
58-
- name: Publish
59-
run: npx vsce publish -p ${{ secrets.VSCE_PAT }}
61+
run: npm ci
62+
- name: GitHub Release
63+
uses: softprops/action-gh-release@v2.5.0
64+
with:
65+
generate_release_notes: true
66+
body: |
67+
# Summary
68+
See [changelog](https://github.com/asux/vscode-rspec-focus/blob/main/CHANGELOG.md#changelog)
69+
name: ${{ github.ref_name }}
70+
fail_on_unmatched_files: true
71+
files: ${{ needs.build.outputs.vsixPath }}
72+
- name: Publish to Open VSX Registry
73+
uses: HaaLeo/publish-vscode-extension@v2
74+
id: publishToOpenVSX
75+
with:
76+
pat: ${{ secrets.OVSX_PAT }}
77+
extensionFile: ${{ needs.build.outputs.vsixPath }}
78+
- name: Publish to Visual Studio Marketplace
79+
uses: HaaLeo/publish-vscode-extension@v2
80+
with:
81+
pat: ${{ secrets.VSCE_PAT }}
82+
registryUrl: https://marketplace.visualstudio.com
83+
extensionFile: ${{ needs.build.outputs.vsixPath }}

0 commit comments

Comments
 (0)