5
5
branches :
6
6
- master
7
7
paths-ignore :
8
+ - ' docs/**'
9
+ - ' .vscode/**'
10
+ - ' .github/**'
8
11
- ' *.md'
9
12
- ' **/*.md'
10
13
pull_request :
15
18
- created
16
19
jobs :
17
20
build :
21
+ timeout-minutes : 10
18
22
runs-on : ${{ matrix.os }}
19
23
strategy :
20
24
matrix :
21
25
os : [ubuntu-latest, windows-latest, macOS-latest]
22
26
steps :
23
- - uses : actions/checkout@master
27
+ - uses : actions/checkout@v2
24
28
- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
25
29
- name : Set an output
26
30
id : set-version
34
38
echo ::set-output name=changelog::$CHANGELOG
35
39
git tag -l | cat
36
40
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f4)+1))
37
- [ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev
41
+ [ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }}
38
42
echo ::set-output name=version::$VERSION
39
43
NAME=$(jq -r '.name' package.json)-$VERSION
40
44
echo ::set-output name=name::$NAME
44
48
echo $VERSION > ./dist/.version
45
49
echo $NAME > ./dist/.name
46
50
- name : Use Node.js
47
- uses : actions/setup-node@master
51
+ uses : actions/setup-node@v1
48
52
with :
49
53
node-version : 12.x
50
54
- run : npm install
@@ -56,18 +60,18 @@ jobs:
56
60
- name : Build package
57
61
if : runner.os == 'Linux'
58
62
run : |
59
- ./node_modules/.bin/vsce package -o ./dist/package .vsix
60
- - uses : actions/upload-artifact@master
63
+ ./node_modules/.bin/vsce package -o ./dist/${{ steps.set-version.outputs.name }} .vsix
64
+ - uses : actions/upload-artifact@v2
61
65
if : runner.os == 'Linux'
62
66
with :
63
67
name : vsix
64
- path : ./dist/
68
+ path : ./dist/${{ steps.set-version.outputs.name }}.vsix
65
69
beta :
66
70
if : (github.event_name == 'push')
67
71
runs-on : ubuntu-latest
68
72
needs : build
69
73
steps :
70
- - uses : actions/download-artifact@master
74
+ - uses : actions/download-artifact@v2
71
75
with :
72
76
name : vsix
73
77
path : ./dist/
80
84
echo ::set-output name=name::`cat ./dist/.name`
81
85
- name : Create Release
82
86
id : create_release
83
- uses : actions/create-release@master
87
+ uses : actions/create-release@v1
84
88
if : runner.os == 'Linux'
85
89
env :
86
90
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -93,13 +97,13 @@ jobs:
93
97
${{ steps.set-version.outputs.changelog }}
94
98
- name : Upload Release Asset
95
99
id : upload-release-asset
96
- uses : actions/upload-release-asset@master
100
+ uses : actions/upload-release-asset@v1
97
101
if : runner.os == 'Linux'
98
102
env :
99
103
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
100
104
with :
101
105
upload_url : ${{ steps.create_release.outputs.upload_url }}
102
- asset_path : ./dist/package .vsix
106
+ asset_path : ./dist/${{ steps.set-version.outputs.name }} .vsix
103
107
asset_name : ${{ steps.set-version.outputs.name }}.vsix
104
108
asset_content_type : application/zip
105
109
publish :
@@ -110,12 +114,12 @@ jobs:
110
114
- uses : actions/checkout@v2
111
115
with :
112
116
ref : master
113
- - uses : actions/download-artifact@master
117
+ - uses : actions/download-artifact@v2
114
118
with :
115
119
name : vsix
116
120
path : ./dist/
117
121
- name : Use Node.js
118
- uses : actions/setup-node@master
122
+ uses : actions/setup-node@v1
119
123
with :
120
124
node-version : 12.x
121
125
- name : Prepare build
@@ -133,21 +137,22 @@ jobs:
133
137
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
134
138
jq '.enableProposedApi = false' package.json > "$tmp" && mv "$tmp" package.json
135
139
npm install
136
- npm i -g vsce ovsx
137
140
git push
138
141
- name : Upload Release Asset
139
142
id : upload-release-asset
140
- uses : actions/upload-release-asset@master
143
+ uses : actions/upload-release-asset@v1
141
144
if : runner.os == 'Linux'
142
145
env :
143
146
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
144
147
with :
145
148
upload_url : ${{ github.event.release.upload_url }}
146
- asset_path : ./dist/package .vsix
149
+ asset_path : ./dist/${{ steps.set-version.outputs.name }} .vsix
147
150
asset_name : ${{ steps.set-version.outputs.name }}.vsix
148
151
asset_content_type : application/zip
149
- - name : Publish to Marketplaces
152
+ - name : Publish to VSCode Marketplace
153
+ run : |
154
+ [ -n "${{ secrets.VSCE_TOKEN }}" ] && ./node_modules/.bin/vsce publish -p ${{ secrets.VSCE_TOKEN }} || true
155
+ - name : Publish to Open VSX Registry
150
156
run : |
151
- vsce publish -p ${{ secrets.VSCE_TOKEN }}
152
- ovsx publish --pat ${{ secrets.OVSX_TOKEN }}
157
+ [ -n "${{ secrets.OVSX_TOKEN }}" ] && ./node_modules/.bin/ovsx publish --pat ${{ secrets.OVSX_TOKEN }} || true
153
158
0 commit comments