12
12
- master
13
13
release :
14
14
types :
15
- - created
15
+ - released
16
16
jobs :
17
17
build :
18
18
timeout-minutes : 10
21
21
matrix :
22
22
os : [ubuntu-latest, windows-latest, macOS-latest]
23
23
steps :
24
- - uses : actions/checkout@master
24
+ - uses : actions/checkout@v2
25
25
- run : git fetch --depth=1 origin +refs/tags/*:refs/tags/*
26
26
- name : Set an output
27
27
id : set-version
@@ -35,17 +35,17 @@ jobs:
35
35
echo ::set-output name=changelog::$CHANGELOG
36
36
git tag -l | cat
37
37
[ $GITHUB_EVENT_NAME == 'push' ] && VERSION+=-beta && VERSION+=.$(($(git tag -l "v$VERSION.*" | sort -nt. -k4 2>/dev/null | tail -1 | cut -d. -f4)+1))
38
- [ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev
38
+ [ $GITHUB_EVENT_NAME == 'pull_request' ] && VERSION+=-dev.${{ github.event.pull_request.number }}
39
39
echo ::set-output name=version::$VERSION
40
40
NAME=$(jq -r '.name' package.json)-$VERSION
41
41
echo ::set-output name=name::$NAME
42
42
tmp=$(mktemp)
43
43
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
44
44
mkdir dist
45
- echo $VERSION > ./dist/. version
46
- echo $NAME > ./dist/. name
45
+ echo $VERSION > .version
46
+ echo $NAME > .name
47
47
- name : Use Node.js
48
- uses : actions/setup-node@master
48
+ uses : actions/setup-node@v1
49
49
with :
50
50
node-version : 12.x
51
51
- run : npm install
@@ -60,31 +60,41 @@ jobs:
60
60
- name : Build package
61
61
if : runner.os == 'Linux'
62
62
run : |
63
- ./node_modules/.bin/vsce package -o ./dist/package.vsix
64
- - uses : actions/upload-artifact@master
63
+ npx vsce package -o ${{ steps.set-version.outputs.name }}.vsix
64
+ - uses : actions/upload-artifact@v2
65
+ if : runner.os == 'Linux'
66
+ with :
67
+ name : ${{ steps.set-version.outputs.name }}.vsix
68
+ path : ${{ steps.set-version.outputs.name }}.vsix
69
+ - uses : actions/upload-artifact@v2
65
70
if : runner.os == 'Linux'
66
71
with :
67
- name : vsix
68
- path : ./dist/
72
+ name : meta
73
+ path : |
74
+ .name
75
+ .version
69
76
beta :
70
77
if : (github.event_name == 'push')
71
78
runs-on : ubuntu-latest
72
79
needs : build
73
80
steps :
74
- - uses : actions/download-artifact@master
81
+ - uses : actions/download-artifact@v2
75
82
with :
76
- name : vsix
77
- path : ./dist/
83
+ name : meta
84
+ path : .
78
85
- name : Set an output
79
86
id : set-version
80
87
if : runner.os == 'Linux'
81
88
run : |
82
89
set -x
83
- echo ::set-output name=version::`cat ./dist/.version`
84
- echo ::set-output name=name::`cat ./dist/.name`
90
+ echo ::set-output name=version::`cat .version`
91
+ echo ::set-output name=name::`cat .name`
92
+ - uses : actions/download-artifact@v2
93
+ with :
94
+ name : ${{ steps.set-version.outputs.name }}.vsix
85
95
- name : Create Release
86
96
id : create_release
87
- uses : actions/create-release@master
97
+ uses : actions/create-release@v1
88
98
if : runner.os == 'Linux'
89
99
env :
90
100
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
@@ -97,13 +107,13 @@ jobs:
97
107
${{ steps.set-version.outputs.changelog }}
98
108
- name : Upload Release Asset
99
109
id : upload-release-asset
100
- uses : actions/upload-release-asset@master
110
+ uses : actions/upload-release-asset@v1
101
111
if : runner.os == 'Linux'
102
112
env :
103
113
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
104
114
with :
105
115
upload_url : ${{ steps.create_release.outputs.upload_url }}
106
- asset_path : ./dist/package .vsix
116
+ asset_path : ${{ steps.set-version.outputs.name }} .vsix
107
117
asset_name : ${{ steps.set-version.outputs.name }}.vsix
108
118
asset_content_type : application/zip
109
119
publish :
@@ -114,20 +124,21 @@ jobs:
114
124
- uses : actions/checkout@v2
115
125
with :
116
126
ref : master
117
- - uses : actions/download-artifact@master
127
+ token : ${{ secrets.TOKEN }}
128
+ - uses : actions/download-artifact@v2
118
129
with :
119
- name : vsix
120
- path : ./dist/
130
+ name : meta
131
+ path : .
121
132
- name : Use Node.js
122
- uses : actions/setup-node@master
133
+ uses : actions/setup-node@v1
123
134
with :
124
135
node-version : 12.x
125
136
- name : Prepare build
126
137
id : set-version
127
138
run : |
128
- VERSION=`cat ./dist/. version`
129
- NEXT_VERSION=`cat ./dist/. version | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
130
- echo ::set-output name=name::`cat ./dist/. name`
139
+ VERSION=`cat .version`
140
+ NEXT_VERSION=`cat .version | awk -F. '/[0-9]+\./{$NF++;print}' OFS=.`
141
+ echo ::set-output name=name::`cat .name`
131
142
tmp=$(mktemp)
132
143
git config --global user.name 'ProjectBot'
133
144
git config --global user.email '[email protected] '
@@ -137,21 +148,26 @@ jobs:
137
148
jq --arg version "$VERSION" '.version = $version' package.json > "$tmp" && mv "$tmp" package.json
138
149
jq '.enableProposedApi = false' package.json > "$tmp" && mv "$tmp" package.json
139
150
npm install
140
- npm i -g vsce ovsx
141
151
git push
152
+ - name : Build package
153
+ run : |
154
+ npx vsce package -o ${{ steps.set-version.outputs.name }}.vsix
142
155
- name : Upload Release Asset
143
156
id : upload-release-asset
144
- uses : actions/upload-release-asset@master
157
+ uses : actions/upload-release-asset@v1
145
158
if : runner.os == 'Linux'
146
159
env :
147
160
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
148
161
with :
149
162
upload_url : ${{ github.event.release.upload_url }}
150
- asset_path : ./dist/package .vsix
163
+ asset_path : ${{ steps.set-version.outputs.name }} .vsix
151
164
asset_name : ${{ steps.set-version.outputs.name }}.vsix
152
165
asset_content_type : application/zip
153
- - name : Publish to Marketplaces
166
+ - name : Publish to VSCode Marketplace
154
167
run : |
155
- vsce publish -p ${{ secrets.VSCE_TOKEN }}
156
- ovsx publish --pat ${{ secrets.OVSX_TOKEN }}
157
-
168
+ [ -n "${{ secrets.VSCE_TOKEN }}" ] && \
169
+ npx vsce publish --packagePath ${{ steps.set-version.outputs.name }}.vsix -p ${{ secrets.VSCE_TOKEN }} || true
170
+ - name : Publish to Open VSX Registry
171
+ run : |
172
+ [ -n "${{ secrets.OVSX_TOKEN }}" ] && \
173
+ npx ovsx publish ${{ steps.set-version.outputs.name }}.vsix --pat ${{ secrets.OVSX_TOKEN }} || true
0 commit comments