-
Notifications
You must be signed in to change notification settings - Fork 0
151 lines (119 loc) · 3.84 KB
/
Copy pathbuild-extension.yml
File metadata and controls
151 lines (119 loc) · 3.84 KB
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
name: Build and Release VS Code Extension
on:
push:
branches: [ main, develop ]
paths-ignore:
- 'docs/**'
- '*.md'
- 'examples/**'
pull_request:
branches: [ main ]
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run linting
run: npm run lint --if-present
- name: Run tests
run: npm test --if-present
- name: Build project
run: npm run compile
- name: Install VSCE
run: npm install -g @vscode/vsce
- name: Package extension
run: vsce package --no-dependencies
- name: Upload extension artifact
uses: actions/upload-artifact@v5
with:
name: sigscan-extension-${{ matrix.node-version }}
path: '*.vsix'
retention-days: 30
release:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run compile
- name: Install VSCE
run: npm install -g @vscode/vsce
- name: Package extension
run: vsce package --no-dependencies
- name: Get package version
id: package-version
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Create release directory
run: mkdir -p releases
- name: Copy VSIX to releases
run: cp *.vsix releases/
- name: Upload to Release (if release event)
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./sigscan-${{ steps.package-version.outputs.version }}.vsix
asset_name: sigscan-${{ steps.package-version.outputs.version }}.vsix
asset_content_type: application/zip
- name: Commit release artifacts (if push to main)
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add releases/
git commit -m "Add built extension v${{ steps.package-version.outputs.version }}" || exit 0
git push
publish-marketplace:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run compile
- name: Install VSCE
run: npm install -g @vscode/vsce
- name: Publish to VS Code Marketplace
if: env.VSCE_PAT != ''
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: vsce publish --no-dependencies
- name: Publish to Open VSX Registry
if: env.OVSX_PAT != ''
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
run: |
npm install -g ovsx
ovsx publish --no-dependencies