11name : CI
22
3- on : [push,release]
4-
3+ on :
4+ push :
5+ branches :
6+ - master
7+ paths-ignore :
8+ - ' *.md'
9+ - ' **/*.md'
10+ pull_request :
11+ branches :
12+ - master
13+ release :
14+ types :
15+ - created
516jobs :
617 build :
718 runs-on : ${{ matrix.os }}
@@ -20,13 +31,17 @@ jobs:
2031 CHANGELOG=$(cat CHANGELOG.md | sed -n "/## \[${VERSION}\]/,/## /p" | sed '/^$/d;1d;$d')
2132 CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
2233 echo ::set-output name=changelog::$CHANGELOG
23- VERSION+=-beta
2434 git tag -l | cat
25- VERSION+=.$(($(git tag -l "v$VERSION.*" 2>/dev/null | tail -1 | cut -d. -f4)+1))
35+ [ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" 2>/dev/null | tail -1 | cut -d. -f4)+1))
36+ [ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev
2637 echo ::set-output name=version::$VERSION
27- echo ::set-output name=name::$(jq -r '.name' package.json)-$VERSION
38+ NAME=$(jq -r '.name' package.json)-$VERSION
39+ echo ::set-output name=name::$NAME
2840 tmp=$(mktemp)
2941 jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
42+ mkdir dist
43+ echo $VERSION > ./dist/.version
44+ echo $NAME > ./dist/.name
3045 - name : Use Node.js
3146 uses : actions/setup-node@master
3247 with :
4055 - name : Build package
4156 if : runner.os == 'Linux'
4257 run : |
43- mkdir dist
44- ./node_modules/.bin/vsce package -o ./dist/vscode-objectscript.vsix
58+ ./node_modules/.bin/vsce package -o ./dist/package.vsix
59+ - uses : actions/upload-artifact@master
60+ if : runner.os == 'Linux'
61+ with :
62+ name : vsix
63+ path : ./dist/
64+ release :
65+ if : (github.event_name == 'release') || (github.event_name == 'push')
66+ runs-on : ubuntu-latest
67+ needs : build
68+ steps :
69+ - uses : actions/download-artifact@master
70+ with :
71+ name : vsix
72+ path : ./dist/
73+ - name : Set an output
74+ id : set-version
75+ if : runner.os == 'Linux'
76+ run : |
77+ set -x
78+ echo ::set-output name=version::`cat ./dist/.version`
79+ echo ::set-output name=name::`cat ./dist/.name`
4580 - name : Create Release
4681 id : create_release
4782 uses : actions/create-release@master
5287 tag_name : v${{ steps.set-version.outputs.version }}
5388 release_name : v${{ steps.set-version.outputs.version }}
5489 draft : false
55- prerelease : true
90+ prerelease : ${{ github.event_name == 'release' }}
5691 body : |
5792 Changes in this release
5893 ${{ steps.set-version.outputs.changelog }}
6499 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65100 with :
66101 upload_url : ${{ steps.create_release.outputs.upload_url }}
67- asset_path : ./dist/vscode-objectscript .vsix
102+ asset_path : ./dist/package .vsix
68103 asset_name : ${{ steps.set-version.outputs.name }}.vsix
69104 asset_content_type : application/zip
0 commit comments