Skip to content

Commit ce457fd

Browse files
committed
(maint) Fix Automatic Github Release
This commit overhauls the github release action in this project to correctly package the vsix, create a github release, and publish the vsix to the VS Code Marketplace when a tag is pushed to the github repo.
1 parent 32e3862 commit ce457fd

File tree

1 file changed

+49
-18
lines changed

1 file changed

+49
-18
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,57 @@
1+
name: release
2+
13
on:
2-
release:
3-
types: [created]
4+
push:
5+
tags:
6+
- '[0-9].[0-9]+.[0-9]+' # Push events matching all semantic versioning tags, i.e. 0.26.01, 1.0, v20.15.10
47

58
env:
69
NODE_VERSION: '12.x'
7-
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
810

911
jobs:
10-
build-and-deploy:
11-
name: Build and Deploy
12+
release:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/checkout@v2
15-
- name: Use Node.js ${{ env.NODE_VERSION }}
16-
uses: actions/setup-node@v1
17-
with:
18-
node-version: ${{ env.NODE_VERSION }}
19-
- name: npm install, build, and test
20-
run: |
21-
npm install
22-
npm run build --if-present
23-
npm run test --if-present
24-
- name: 'Deploy to Azure WebApp'
25-
run: |
26-
npm publish -p $VSCE_TOKEN
15+
- uses: actions/checkout@v2
16+
- name: Node ${{ env.NODE_VERSION }}
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: ${{ env.NODE_VERSION }}
20+
21+
- name: Package vsix
22+
id: create_package
23+
run: |
24+
npm i
25+
npx vsce package
26+
27+
- name: Set vsix version
28+
id: vsce
29+
run: |
30+
echo "::set-output name=version::$(cat package.json | jq -r .version)"
31+
32+
- name: Create Github Release
33+
id: create_github_release
34+
uses: actions/create-release@v1
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
with:
38+
tag_name: ${{ github.ref }}
39+
release_name: ${{ steps.vsce.outputs.version }}
40+
draft: false
41+
prerelease: false
42+
43+
- name: Upload vsix
44+
id: upload-release-asset
45+
uses: actions/upload-release-asset@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
upload_url: ${{ steps.create_github_release.outputs.upload_url }}
50+
asset_path: ./puppet-vscode-${{ steps.vsce.outputs.version }}.vsix
51+
asset_name: puppet-vscode-${{ steps.vsce.outputs.version }}.vsix
52+
asset_content_type: application/zip
53+
54+
- name: Publish Extension
55+
id: publish-release-asset
56+
run: |
57+
npx vsce publish -p ${{ secrets.VSCE_TOKEN }} --packagePath ./puppet-vscode-${{ steps.vsce.outputs.version }}.vsix

0 commit comments

Comments
 (0)