-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (121 loc) · 3.32 KB
/
ci.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
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
# Adapted from https://github.com/HaaLeo/vscode-timing/.github/workflows/cicd.yml
name: CI
on:
push:
branches:
- '*'
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- ready_for_review
release:
types:
- published
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}'
cancel-in-progress: true
env:
SKIP: make-all
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- uses: pre-commit/[email protected]
build-test-lint:
name: Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: setup-xvfb
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
- macos-latest
node:
- 22.2.0
outputs:
vsixPath: ${{ steps.packageExtension.outputs.vsixPath }}
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Install Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: npm ci
- name: Run Linter
run: npm run lint
- name: Build Code
run: npm run compile
- name: Package Extension
id: packageExtension
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: stub
dryRun: true
- name: Upload Extension Package as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: ${{ steps.packageExtension.outputs.vsixPath }}
overwrite: true
setup-xvfb:
runs-on: ubuntu-latest
steps:
- name: Set up Xvfb
run: |
sudo apt-get update
sudo apt-get install xvfb
- name: Start Xvfb
run: Xvfb :99 -screen 0 1280x1024x24 &
publish:
name: Publish Github Action
needs:
- build-test-lint
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout Source
uses: actions/checkout@v4
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: 22.2.0
- name: Install Dependencies
run: npm ci
- name: Download Build Artifact
uses: actions/download-artifact@v4
with:
name: ubuntu-latest
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: false
name: ${{ github.ref_name }}
fail_on_unmatched_files: true
files: |
${{ needs.build-lint.outputs.vsixPath }}
LICENSE
README.md
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
extensionFile: ${{ needs.build-lint.outputs.vsixPath }}
registryUrl: https://marketplace.visualstudio.com
- name: Publish to Open VSX Registry
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.OPEN_VSX_TOKEN }}
extensionFile: ${{ needs.build-lint.outputs.vsixPath }}