|
1 | 1 | name: Publish VS Code Extension on Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - release: |
5 | | - types: [published] |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - dev |
6 | 7 |
|
7 | 8 | jobs: |
8 | 9 | publish: |
9 | 10 | runs-on: ubuntu-latest |
10 | 11 |
|
11 | 12 | steps: |
12 | | - # Step 1: Check out the repository |
13 | 13 | - name: Checkout repository |
14 | 14 | uses: actions/checkout@v3 |
15 | | - |
16 | | - # Step 2: Set up Node.js (required for vsce) |
17 | 15 | - name: Set up Node.js |
18 | 16 | uses: actions/setup-node@v3 |
19 | 17 | with: |
20 | | - node-version: '18' # specify the Node.js version compatible with your project |
21 | | - |
22 | | - # Step 3: Install dependencies |
| 18 | + node-version: '20' |
23 | 19 | - name: Install dependencies |
24 | 20 | run: npm install |
25 | | - |
26 | | - # Step 4: Package and publish the extension using vsce |
27 | | - - name: Publish Extension |
28 | | - env: |
29 | | - VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }} |
30 | | - run: | |
31 | | - npm install -g @vscode/vsce |
32 | | - vsce package |
33 | | - vsce publish || exit 1 # Fail the workflow if publish fails |
34 | | -
|
35 | | - # Step 5: Update Release Notes (optional) |
| 21 | + - name: Publish to Open VSX Registry |
| 22 | + uses: HaaLeo/publish-vscode-extension@v1 |
| 23 | + id: publishToOpenVSX |
| 24 | + with: |
| 25 | + pat: ${{ secrets.OPEN_VSX_TOKEN }} |
| 26 | + - name: Publish to Visual Studio Marketplace |
| 27 | + uses: HaaLeo/publish-vscode-extension@v1 |
| 28 | + with: |
| 29 | + pat: ${{ secrets.VSCE_TOKEN }} |
| 30 | + registryUrl: https://marketplace.visualstudio.com |
| 31 | + extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }} |
36 | 32 | - name: Update release to published |
37 | 33 | if: success() |
38 | 34 | uses: actions/github-script@v6 |
|
43 | 39 | owner: context.repo.owner, |
44 | 40 | repo: context.repo.repo, |
45 | 41 | release_id: context.payload.release.id, |
46 | | - draft: false, # Make it a published release only if the workflow succeeds |
| 42 | + draft: false, # Make it a published release only if the workflow succeeds |
47 | 43 | prerelease: false |
48 | 44 | }); |
0 commit comments