-
Notifications
You must be signed in to change notification settings - Fork 16
78 lines (75 loc) · 2.14 KB
/
ci-cd.yaml
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
name: CI/CD
on:
push:
branches: [main]
tags:
- 'v*.*.*'
pull_request:
branches: [main]
jobs:
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Run Prettier
run: npm run prettier:check
- name: Run Lint
run: npm run lint:check
- name: Run Tests
uses: coactions/setup-xvfb@v1
with:
run: npm test
publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: test
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install Dependencies
run: npm ci
- name: Package Extension
run: npm run package
- name: Set Environment Variables
run: |
node -e "console.log('PACKAGE_VERSION=' + require('./package.json').version)" >> $GITHUB_ENV
echo "PACKAGE_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
- name: Generate Changelog
id: changelog
uses: mindsers/changelog-reader-action@v2
with:
validation_level: warn
version: ${{ env.PACKAGE_VERSION }}
path: ./CHANGELOG.md
- name: Create GitHub Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
name: ${{ github.ref_name }}
body: ${{ steps.changelog.outputs.changes }}
draft: false
prerelease: false
files: ${{ env.PACKAGE_PATH }}
- name: Publish Extension
run: npm run publish
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}