1
1
name : CI
2
2
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
5
16
jobs :
6
17
build :
7
18
runs-on : ${{ matrix.os }}
@@ -20,13 +31,17 @@ jobs:
20
31
CHANGELOG=$(cat CHANGELOG.md | sed -n "/## \[${VERSION}\]/,/## /p" | sed '/^$/d;1d;$d')
21
32
CHANGELOG="${CHANGELOG//$'\n'/'%0A'}"
22
33
echo ::set-output name=changelog::$CHANGELOG
23
- VERSION+=-beta
24
34
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
26
37
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
28
40
tmp=$(mktemp)
29
41
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
30
45
- name : Use Node.js
31
46
uses : actions/setup-node@master
32
47
with :
40
55
- name : Build package
41
56
if : runner.os == 'Linux'
42
57
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`
45
80
- name : Create Release
46
81
id : create_release
47
82
uses : actions/create-release@master
52
87
tag_name : v${{ steps.set-version.outputs.version }}
53
88
release_name : v${{ steps.set-version.outputs.version }}
54
89
draft : false
55
- prerelease : true
90
+ prerelease : ${{ github.event_name == 'release' }}
56
91
body : |
57
92
Changes in this release
58
93
${{ steps.set-version.outputs.changelog }}
64
99
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
65
100
with :
66
101
upload_url : ${{ steps.create_release.outputs.upload_url }}
67
- asset_path : ./dist/vscode-objectscript .vsix
102
+ asset_path : ./dist/package .vsix
68
103
asset_name : ${{ steps.set-version.outputs.name }}.vsix
69
104
asset_content_type : application/zip
0 commit comments