Skip to content

Commit e592aaa

Browse files
authored
support to release
1 parent 25db5c7 commit e592aaa

File tree

1 file changed

+34
-5
lines changed

1 file changed

+34
-5
lines changed

.github/workflows/release.yaml

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
name: Build
2+
13
on:
24
push:
35
branches:
46
- master
7+
tags:
8+
- "*"
59
release:
610
types:
711
- created
@@ -24,8 +28,33 @@ jobs:
2428
if: runner.os == 'Linux'
2529
- run: npm test
2630
if: runner.os != 'Linux'
27-
# - name: Publish
28-
# if: success() && startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest'
29-
# run: npm run deploy
30-
# env:
31-
# VSCE_PAT: ${{ secrets.VSCE_PAT }}
31+
32+
Release:
33+
runs-on: ubuntu-22.04
34+
permissions:
35+
contents: write
36+
steps:
37+
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
38+
- name: Update version
39+
if: github.event_name != 'pull_request'
40+
run: |
41+
export TAG=${GITHUB_REF#refs/*/}
42+
export TAG=${TAG#"v"}
43+
echo "change the version to ${TAG}"
44+
jq '.version = env.TAG' package.json > package.json.new && mv package.json.new package.json
45+
- name: Build
46+
run: |
47+
npm i
48+
npm install -g @vscode/vsce
49+
vsce package
50+
- name: Publish
51+
if: github.event_name != 'pull_request'
52+
run: |
53+
npx ovsx publish -p ${{ secrets.OPEN_VSX_TKN }} *.vsix
54+
- name: Upload Release Asset
55+
if: github.event_name != 'pull_request'
56+
run: |
57+
export TAG=${GITHUB_REF#refs/*/}
58+
gh release upload ${TAG} *.vsix
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)