-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (73 loc) · 2.1 KB
/
test-and-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
name: Test and Release
# Run this job on all pushes to main and for pull requests
on:
push:
branches:
# This avoids having duplicate builds in non-forked PRs
- "main"
tags:
# normal versions
- "v[0-9]+.[0-9]+.[0-9]+"
# pre-releases
- "v[0-9]+.[0-9]+.[0-9]+-**"
pull_request: {}
# Cancel previous PR/branch runs when a new commit is pushed
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
# ===================
# Tests everything
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x] # This should be LTS
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Compile
run: npm run build
- name: Lint
run: npm run lint
# ===================
# Deploys successful builds tagged with a version to the marketplace
deploy:
if: |
github.event_name == 'push' &&
startsWith(github.ref, 'refs/tags/v')
needs: [test]
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x] # This should be LTS
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Install vsce
run: npm install -g @vscode/vsce
- name: Publish to the Open VSX Registry
uses: HaaLeo/[email protected]
id: publishToOpenVSX
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
- name: Publish to the Visual Studio Marketplace
uses: HaaLeo/[email protected]
with:
pat: ${{ secrets.MARKETPLACE_TOKEN }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }}