16
16
set -e
17
17
/usr/bin/Xvfb :10 -ac >> /tmp/Xvfb.out 2>&1 &
18
18
disown -ar
19
+ - name : Set an output
20
+ id : set-version
21
+ if : runner.os == 'Linux'
22
+ run : |
23
+ VERSION=$(jq -r '.version' package.json | cut -d- -f1)
24
+ echo ::set-output name=changelog::$(cat CHANGELOG.md | sed -n "/## \[${VERSION}\]/,/## /p" | sed '/^$/d;1d;$d')
25
+ BUILD=$(($(git tag -l "v$VERSION-beta.*" 2>/dev/null | tail -1 | rev | cut -d. -f1)+1))
26
+ VERSION+=-B$(date -u "+%Y%m%d").$BUILD
27
+ echo ::set-output name=version::$VERSION
28
+ echo ::set-output name=name::$(jq -r '.name' package.json)-$VERSION
29
+ tmp=$(mktemp)
30
+ jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
19
31
- name : Use Node.js
20
32
uses : actions/setup-node@master
21
33
with :
@@ -25,36 +37,31 @@ jobs:
25
37
- run : npm run test
26
38
env :
27
39
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")
34
40
- name : Build package
35
41
if : runner.os == 'Linux'
36
42
run : |
37
43
mkdir dist
38
- ./node_modules/.bin/vsce package -o ./dist/${{ steps.get -version.outputs.name }}.vsix
44
+ ./node_modules/.bin/vsce package -o ./dist/${{ steps.set -version.outputs.name }}.vsix
39
45
- name : Create Release
40
46
id : create_release
41
47
uses : actions/create-release@v1
42
48
if : runner.os == 'Linux'
43
49
env :
44
50
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45
51
with :
46
- tag_name : v${{ steps.get-version.outputs.version }}
47
- release_name : v${{ steps.get-version.outputs.version }}
52
+ tag_name : v${{ steps.set-version.outputs.version }}
53
+ release_name : v${{ steps.set-version.outputs.version }}
54
+ body : v${{ steps.set-version.outputs.changelog}}
48
55
draft : false
49
56
prerelease : true
50
57
- name : Upload Release Asset
51
- id : upload-release-asset
58
+ id : upload-release-asset
52
59
uses : actions/upload-release-asset@v1.0.1
53
60
if : runner.os == 'Linux'
54
61
env :
55
62
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56
63
with :
57
64
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
65
+ asset_path : ./dist/${{ steps.set -version.outputs.name }}.vsix
66
+ asset_name : ${{ steps.set -version.outputs.name }}.vsix
67
+ asset_content_type : application/zip
0 commit comments