25
25
os : [ubuntu-latest, windows-latest, macOS-latest]
26
26
steps :
27
27
- uses : actions/checkout@v2
28
- with :
29
- ref : master
30
28
- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
31
29
- name : Set an output
32
30
id : set-version
40
38
echo ::set-output name=changelog::$CHANGELOG
41
39
git tag -l | cat
42
40
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f4)+1))
43
- [ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev
41
+ [ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }}
44
42
echo ::set-output name=version::$VERSION
45
43
NAME=$(jq -r '.name' package.json)-$VERSION
46
44
echo ::set-output name=name::$NAME
@@ -65,12 +63,12 @@ jobs:
65
63
- name : Build package
66
64
if : runner.os == 'Linux'
67
65
run : |
68
- ./node_modules/.bin/vsce package -o ./dist/package .vsix
66
+ ./node_modules/.bin/vsce package -o ./dist/${{ steps.set-version.outputs.name }} .vsix
69
67
- uses : actions/upload-artifact@v2
70
68
if : runner.os == 'Linux'
71
69
with :
72
70
name : vsix
73
- path : ./dist/
71
+ path : ./dist/${{ steps.set-version.outputs.name }}.vsix
74
72
beta :
75
73
if : (github.event_name == 'push')
76
74
runs-on : ubuntu-latest
@@ -108,7 +106,7 @@ jobs:
108
106
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
109
107
with :
110
108
upload_url : ${{ steps.create_release.outputs.upload_url }}
111
- asset_path : ./dist/package .vsix
109
+ asset_path : ./dist/${{ steps.set-version.outputs.name }} .vsix
112
110
asset_name : ${{ steps.set-version.outputs.name }}.vsix
113
111
asset_content_type : application/zip
114
112
publish :
@@ -144,6 +142,7 @@ jobs:
144
142
jq '.enableProposedApi = false' package.json > "$tmp" && mv "$tmp" package.json
145
143
npm install
146
144
git push
145
+ echo ::set-output name=ovsx::`cat ./dist/.name`
147
146
- name : Upload Release Asset
148
147
id : upload-release-asset
149
148
uses : actions/upload-release-asset@v1
@@ -152,11 +151,13 @@ jobs:
152
151
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
153
152
with :
154
153
upload_url : ${{ github.event.release.upload_url }}
155
- asset_path : ./dist/package .vsix
154
+ asset_path : ./dist/${{ steps.set-version.outputs.name }} .vsix
156
155
asset_name : ${{ steps.set-version.outputs.name }}.vsix
157
156
asset_content_type : application/zip
158
- - name : Publish to Marketplaces
157
+ - name : Publish to VSCode Marketplace
158
+ run : |
159
+ [ -n "${{ secrets.VSCE_TOKEN }}" ] && ./node_modules/.bin/vsce publish -p ${{ secrets.VSCE_TOKEN }} || true
160
+ - name : Publish to Open VSX Registry
159
161
run : |
160
- ./node_modules/.bin/vsce publish -p ${{ secrets.VSCE_TOKEN }}
161
- ./node_modules/.bin/ovsx publish --pat ${{ secrets.OVSX_TOKEN }}
162
+ [ -n "${{ secrets.OVSX_TOKEN }}" ] && ./node_modules/.bin/ovsx publish --pat ${{ secrets.OVSX_TOKEN }} || true
162
163
0 commit comments