2525 os : [ubuntu-latest, windows-latest, macOS-latest]
2626 steps :
2727 - uses : actions/checkout@v2
28- with :
29- ref : master
3028 - run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
3129 - name : Set an output
3230 id : set-version
4038 echo ::set-output name=changelog::$CHANGELOG
4139 git tag -l | cat
4240 [ $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 }}
4442 echo ::set-output name=version::$VERSION
4543 NAME=$(jq -r '.name' package.json)-$VERSION
4644 echo ::set-output name=name::$NAME
@@ -65,12 +63,12 @@ jobs:
6563 - name : Build package
6664 if : runner.os == 'Linux'
6765 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
6967 - uses : actions/upload-artifact@v2
7068 if : runner.os == 'Linux'
7169 with :
7270 name : vsix
73- path : ./dist/
71+ path : ./dist/${{ steps.set-version.outputs.name }}.vsix
7472 beta :
7573 if : (github.event_name == 'push')
7674 runs-on : ubuntu-latest
@@ -108,7 +106,7 @@ jobs:
108106 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
109107 with :
110108 upload_url : ${{ steps.create_release.outputs.upload_url }}
111- asset_path : ./dist/package .vsix
109+ asset_path : ./dist/${{ steps.set-version.outputs.name }} .vsix
112110 asset_name : ${{ steps.set-version.outputs.name }}.vsix
113111 asset_content_type : application/zip
114112 publish :
@@ -144,6 +142,7 @@ jobs:
144142 jq '.enableProposedApi = false' package.json > "$tmp" && mv "$tmp" package.json
145143 npm install
146144 git push
145+ echo ::set-output name=ovsx::`cat ./dist/.name`
147146 - name : Upload Release Asset
148147 id : upload-release-asset
149148 uses : actions/upload-release-asset@v1
@@ -152,11 +151,13 @@ jobs:
152151 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
153152 with :
154153 upload_url : ${{ github.event.release.upload_url }}
155- asset_path : ./dist/package .vsix
154+ asset_path : ./dist/${{ steps.set-version.outputs.name }} .vsix
156155 asset_name : ${{ steps.set-version.outputs.name }}.vsix
157156 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
159161 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
162163
0 commit comments