@@ -10,12 +10,27 @@ jobs:
1010 os : [ubuntu-latest, windows-latest, macOS-latest]
1111 steps :
1212 - uses : actions/checkout@master
13+ - run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
1314 - name : Start xvfb
1415 if : runner.os == 'Linux'
1516 run : |
1617 set -e
1718 /usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 &
1819 disown -ar
20+ - name : Set an output
21+ id : set-version
22+ if : runner.os == 'Linux'
23+ run : |
24+ set -x
25+ VERSION=$(jq -r '.version' package.json | cut -d- -f1)
26+ echo ::set-output name=changelog::$(cat CHANGELOG.md | sed -n "/## \[${VERSION}\]/,/## /p" | sed '/^$/d;1d;$d')
27+ VERSION+=-beta
28+ git tag -l | cat
29+ VERSION+=.$(($(git tag -l "v$VERSION.*" 2>/dev/null | tail -1 | cut -d. -f4)+1))
30+ echo ::set-output name=version::$VERSION
31+ echo ::set-output name=name::$(jq -r '.name' package.json)-$VERSION
32+ tmp=$(mktemp)
33+ jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
1934 - name : Use Node.js
2035 uses : actions/setup-node@master
2136 with :
@@ -25,36 +40,33 @@ jobs:
2540 - run : npm run test
2641 env :
2742 DISPLAY : :10
28- - name : Set an output
29- id : get-version
30- if : runner.os == 'Linux'
31- run : |
32- echo ::set-output name=version::$(jq -r '.version' package.json | cut -d- -f1)-B$(date -u "+%Y%m%d")
33- echo ::set-output name=name::$(jq -r '.name+"-"+.version' package.json | cut -d- -f1-3)-B$(date -u "+%Y%m%d")
3443 - name : Build package
3544 if : runner.os == 'Linux'
3645 run : |
3746 mkdir dist
38- ./node_modules/.bin/vsce package -o ./dist/${{ steps.get -version.outputs.name }}.vsix
47+ ./node_modules/.bin/vsce package -o ./dist/${{ steps.set -version.outputs.name }}.vsix
3948 - name : Create Release
4049 id : create_release
4150 uses : actions/create-release@v1
4251 if : runner.os == 'Linux'
4352 env :
4453 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4554 with :
46- tag_name : v${{ steps.get-version.outputs.version }}
47- release_name : v${{ steps.get-version.outputs.version }}
55+ tag_name : v${{ steps.set-version.outputs.version }}
56+ release_name : v${{ steps.set-version.outputs.version }}
57+ body : |
58+ Changes in this release
59+ ${{ steps.set-version.outputs.changelog}}
4860 draft : false
4961 prerelease : true
5062 - name : Upload Release Asset
51- id : upload-release-asset
63+ id : upload-release-asset
5264 uses : actions/upload-release-asset@v1.0.1
5365 if : runner.os == 'Linux'
5466 env :
5567 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
5668 with :
5769 upload_url : ${{ steps.create_release.outputs.upload_url }}
58- asset_path : ./dist/${{ steps.get -version.outputs.name }}.vsix
59- asset_name : ${{ steps.get -version.outputs.name }}.vsix
60- asset_content_type : application/zip
70+ asset_path : ./dist/${{ steps.set -version.outputs.name }}.vsix
71+ asset_name : ${{ steps.set -version.outputs.name }}.vsix
72+ asset_content_type : application/zip
0 commit comments