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