-
Notifications
You must be signed in to change notification settings - Fork 16
402 lines (349 loc) · 19.4 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
name: Release
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Runme release version"
required: true
type: string
default: latest
releaseType:
description: "Release Type"
required: true
type: choice
default: "patch"
options:
- patch
- minor
- major
releaseChannel:
description: "Release Channel"
required: true
type: choice
default: stable
options:
- stable
- edge
publishMarketplace:
description: "Publish on Visual Studio Marketplace?"
required: true
type: choice
default: "yes"
options:
- "yes"
- "no"
publishOpenVSX:
description: "Publish on Open VSX Registry?"
required: true
type: choice
default: "yes"
options:
- "yes"
- "no"
jobs:
release:
runs-on: ubuntu-latest
env:
REPOSITORY: runme
steps:
- name: Clone Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Dependencies
run: npm ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build Package (Edge)
run: npm run build:dev
env:
NODE_ENV: development
INSTRUMENTATION_KEY: ${{ secrets.INSTRUMENTATION_KEY }}
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
- name: Build Package (Stable)
run: npm run build:prod
env:
NODE_ENV: production
INSTRUMENTATION_KEY: ${{ secrets.INSTRUMENTATION_KEY }}
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
- name: Run Tests
uses: coactions/setup-xvfb@v1
with:
run: npm test
options: "-screen 0 1600x1200x24"
- name: Set Extension Name
run: |
EXTENSION_NAME=$(node -p 'require("./package.json").name')
echo "EXTENSION_NAME=${EXTENSION_NAME}" >> $GITHUB_ENV
- name: Get stable releases
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { default: checkRelease } = await import('${{ github.workspace }}/.github/scripts/checkRelease.js')
await checkRelease({ github, context, core })
- name: Create Changelog
run: |
git log $(git describe --tags --abbrev=0)..HEAD --oneline &> ${{ github.workspace }}-CHANGELOG.txt
cat ${{ github.workspace }}-CHANGELOG.txt
- name: Setup Git
run: |
git config --global user.name "stateful-wombot"
git config --global user.email "christian+github-bot@stateful.com"
- name: Get Current Version Number
run: |
CURRENT_VERSION=$(cat package.json | jq .version | cut -d'"' -f 2)
echo "CURRENT_VERSION=$CURRENT_VERSION" >> $GITHUB_ENV
- name: Compile New Version (Edge)
run: |
RELEASE_VERSION="$(npx semver $CURRENT_VERSION -i pre${{ github.event.inputs.releaseType }} --preid edge)"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "Bump to $RELEASE_VERSION"
if: ${{ github.event.inputs.releaseChannel == 'edge' && !contains(env.CURRENT_VERSION, 'edge') }}
- name: Compile New Version (Edge)
run: |
RELEASE_VERSION="$(npx semver $CURRENT_VERSION -i prerelease)"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "Bump to $RELEASE_VERSION"
if: ${{ github.event.inputs.releaseChannel == 'edge' && contains(env.CURRENT_VERSION, 'edge') }}
- name: Compile New Version (Stable)
run: |
RELEASE_VERSION="$(npx semver $CURRENT_VERSION -i github.event.inputs.releaseType)"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "Bump to $RELEASE_VERSION"
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
- name: Tag Check
id: tag_check
run: |
GET_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/git/ref/tags/v${RELEASE_VERSION}"
http_status_code=$(curl -LI $GET_API_URL -o /dev/null -w '%{http_code}\n' -s \
-H "Authorization: token ${GITHUB_TOKEN}")
if [ "$http_status_code" -ne "404" ] ; then
echo "exists_tag=true" >> $GITHUB_OUTPUT
else
echo "exists_tag=false" >> $GITHUB_OUTPUT
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Version Package
if: steps.tag_check.outputs.exists_tag == 'false'
run: |
npm version $RELEASE_VERSION
git tag -a $RELEASE_VERSION -m "$RELEASE_VERSION"
# Update Edge version
- name: Update edge version
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: node .github/scripts/updateEdgeVersion.js
- name: Deactivate panels for public releases
run: |
jq 'del( .contributes.viewsContainers ) | del( .contributes.views.runme )' package.json > _package.json
mv -f _package.json package.json
# if: ${{ github.event.inputs.releaseChannel == 'stable' }}
# Linux X86
- name: Package Extension Linux x86_64 (Edge)
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: npx vsce package -t linux-x64 --pre-release --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-linux-x64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_LINUX_x86_64 }}
TYPE: 'tar'
- name: Package Extension Linux x86_64 (Stable)
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
run: npx vsce package $RELEASE_VERSION -t linux-x64 --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-linux-x64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_LINUX_x86_64 }}
TYPE: 'tar'
# Linux arm64
- name: Package Linux arm64 (Edge)
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: npx vsce package -t linux-arm64 --pre-release --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-linux-arm64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_LINUX_arm64 }}
TYPE: 'tar'
- name: Package Linux arm64 (Stable)
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
run: npx vsce package $RELEASE_VERSION -t linux-arm64 --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-linux-arm64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_LINUX_arm64 }}
TYPE: 'tar'
# MacOS x86_64
- name: Package MacOS x86_64 (Edge)
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: npx vsce package -t darwin-x64 --pre-release --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-darwin-x64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_MACOS_x86_64 }}
TYPE: 'tar'
- name: Package MacOS x86_64 (Stable)
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
run: npx vsce package $RELEASE_VERSION -t darwin-x64 --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-darwin-x64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_MACOS_x86_64 }}
TYPE: 'tar'
# MacOS arm64
- name: Package MacOS arm64 (Edge)
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: npx vsce package -t darwin-arm64 --pre-release --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-darwin-arm64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_MACOS_arm64 }}
TYPE: 'tar'
- name: Package MacOS arm64 (Stable)
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
run: npx vsce package $RELEASE_VERSION -t darwin-arm64 --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-darwin-arm64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_MACOS_arm64 }}
TYPE: 'tar'
# Windows x64
- name: Package Windows x64 (Edge)
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: npx vsce package -t win32-x64 --pre-release --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-win32-x64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_WINDOWS_x86_64 }}
TYPE: 'zip'
- name: Package Windows x64 (Stable)
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
run: npx vsce package $RELEASE_VERSION -t win32-x64 --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-win32-x64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_WINDOWS_x86_64 }}
TYPE: 'zip'
# Windows arm64
- name: Package Windows arm64 (Edge)
if: ${{ github.event.inputs.releaseChannel == 'edge' }}
run: npx vsce package -t win32-arm64 --pre-release --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-win32-arm64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_WINDOWS_arm64 }}
TYPE: 'zip'
- name: Package Windows arm64 (Stable)
if: ${{ github.event.inputs.releaseChannel == 'stable' }}
run: npx vsce package $RELEASE_VERSION -t win32-arm64 --no-yarn --no-git-tag-version --no-update-package-json -o "./${{ env.EXTENSION_NAME }}-win32-arm64-$RELEASE_VERSION.vsix" ${{ github.event.inputs.additionalFlags }}
env:
DOWNLOAD_URL: ${{ env.DOWNLOAD_URL_WINDOWS_arm64 }}
TYPE: 'zip'
# Distribute
# Visual Studio Marketplace
# Linux X86
- name: Publish to Visual Studio Marketplace Linux X86 (Edge)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-linux-x64-$RELEASE_VERSION.vsix" --pre-release --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'edge' }}
- name: Publish to Visual Studio Marketplace Linux X86 (Stable)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-linux-x64-$RELEASE_VERSION.vsix" --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
# Linux arm64
- name: Publish to Visual Studio Marketplace Linux arm64 (Edge)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-linux-arm64-$RELEASE_VERSION.vsix" --pre-release --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'edge' }}
- name: Publish to Visual Studio Marketplace Linux arm64 (Stable)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-linux-arm64-$RELEASE_VERSION.vsix" --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
# MacOS x86_64
- name: Publish to Visual Studio Marketplace MacOS x86_64 (Edge)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-darwin-x64-$RELEASE_VERSION.vsix" --pre-release --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'edge' }}
- name: Publish to Visual Studio Marketplace MacOS x86_64 (Stable)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-darwin-x64-$RELEASE_VERSION.vsix" --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
# MacOS arm64
- name: Publish to Visual Studio Marketplace MacOS arm64 (Edge)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-darwin-arm64-$RELEASE_VERSION.vsix" --pre-release --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'edge' }}
- name: Publish to Visual Studio Marketplace MacOS arm64 (Stable)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-darwin-arm64-$RELEASE_VERSION.vsix" --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
# Windows x64
- name: Publish to Visual Studio Marketplace Windows x64 (Edge)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-win32-x64-$RELEASE_VERSION.vsix" --pre-release --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'edge' }}
- name: Publish to Visual Studio Marketplace MacOS x64 (Stable)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-win32-x64-$RELEASE_VERSION.vsix" --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
# Windows arm64
- name: Publish to Visual Studio Marketplace Windows arm64 (Edge)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-win32-arm64-$RELEASE_VERSION.vsix" --pre-release --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'edge' }}
- name: Publish to Visual Studio Marketplace Windows arm64 (Stable)
run: npx vsce publish --packagePath "./$EXTENSION_NAME-win32-arm64-$RELEASE_VERSION.vsix" --no-yarn --no-git-tag-version --no-update-package-json -p ${{ secrets.VSC_MKTP_PAT }} ${{ github.event.inputs.additionalFlags }}
if: ${{ github.event.inputs.publishMarketplace == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
# VSX Registry (only Stable releases)
# Linux X86
- name: Publish to Open VSX Registry Linux X86 (Stable)
uses: HaaLeo/publish-vscode-extension@v1
timeout-minutes: 20
# continue-on-error: true
if: ${{ github.event.inputs.publishOpenVSX == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
with:
preRelease: false
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ./${{ env.EXTENSION_NAME }}-linux-x64-${{ env.RELEASE_VERSION }}.vsix
# Linux arm64
- name: Publish to Open VSX Registry Linux arm64 (Stable)
uses: HaaLeo/publish-vscode-extension@v1
timeout-minutes: 20
# continue-on-error: true
if: ${{ github.event.inputs.publishOpenVSX == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
with:
preRelease: false
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ./${{ env.EXTENSION_NAME }}-linux-arm64-${{ env.RELEASE_VERSION }}.vsix
# MacOS x86_64
- name: Publish to Open VSX Registry MacOS x86_64 (Stable)
uses: HaaLeo/publish-vscode-extension@v1
timeout-minutes: 20
# continue-on-error: true
if: ${{ github.event.inputs.publishOpenVSX == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
with:
preRelease: false
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ./${{ env.EXTENSION_NAME }}-darwin-x64-${{ env.RELEASE_VERSION }}.vsix
# MacOS arm64
- name: Publish to Open VSX Registry MacOS arm64 (Stable)
uses: HaaLeo/publish-vscode-extension@v1
timeout-minutes: 20
# continue-on-error: true
if: ${{ github.event.inputs.publishOpenVSX == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
with:
preRelease: false
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ./${{ env.EXTENSION_NAME }}-darwin-arm64-${{ env.RELEASE_VERSION }}.vsix
# Windows x64
- name: Publish to Open VSX Registry Windows x64 (Stable)
uses: HaaLeo/publish-vscode-extension@v1
timeout-minutes: 20
# continue-on-error: true
if: ${{ github.event.inputs.publishOpenVSX == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
with:
preRelease: false
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ./${{ env.EXTENSION_NAME }}-win32-x64-${{ env.RELEASE_VERSION }}.vsix
# Windows arm64
- name: Publish to Open VSX Registry Windows arm64 (Stable)
uses: HaaLeo/publish-vscode-extension@v1
timeout-minutes: 20
# continue-on-error: true
if: ${{ github.event.inputs.publishOpenVSX == 'yes' && github.event.inputs.releaseChannel == 'stable' }}
with:
preRelease: false
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ./${{ env.EXTENSION_NAME }}-win32-arm64-${{ env.RELEASE_VERSION }}.vsix
# Release
- name: Push Tags
continue-on-error: true
run: |
git log -1 --stat
git push origin main --tags
- run: |
export GIT_TAG=$(git describe --tags --abbrev=0)
echo "GIT_TAG=$GIT_TAG" >> $GITHUB_ENV
- name: GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: "./runme-*"
bodyFile: ${{ github.workspace }}-CHANGELOG.txt
tag: ${{ env.GIT_TAG }}
prerelease: ${{ github.event.inputs.releaseChannel == 'edge' }}
- name: 🐛 Debug Build
uses: stateful/vscode-server-action@v1
if: failure()
with:
timeout: "300000"