-
Notifications
You must be signed in to change notification settings - Fork 16
93 lines (90 loc) · 2.96 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
name: Build .vsix release asset
on:
push:
pull_request:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Enable corepack
run: corepack enable
- name: Setup node v20
uses: actions/setup-node@v4
with:
# the current node version included in VS Code
node-version: '20'
cache: 'yarn'
- name: Install Dependencies
run: |
npm i -g @vscode/vsce ovsx
yarn
- name: Lint Extension
run: yarn lint
- name: Package Extension Debug Version
run: |
vsce package
for file in raspberry-pi-pico-*.vsix; do
mv "$file" "debug-${file%.vsix}.vsix"
# Exit the loop after the first detection
break
done
env:
BUILD_ENV: debug
- name: Package Extension Production Version
run: vsce package
env:
BUILD_ENV: production
- name: Modify package.json for OVSX
# ms-vscode extensions not available on OpenVSX registry, so remove dependencies
run: |
sed -i 's/"ms-vscode.*",//g' package.json
- name: Package Extension for OVSX
run: |
version=$(jq -r '.version' package.json)
vsce package -o ovsx-raspberry-pi-pico-${version}.vsix
env:
BUILD_ENV: production
- name: Test PAT
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_PAT }}
run: |
vsce verify-pat raspberry-pi
- name: Test OVSX PAT
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
run: |
npx ovsx verify-pat -p ${{ secrets.OPEN_VSX_PAT }}
- name: Get Short Commit SHA
run: |
short_sha=$(git rev-parse --short "$GITHUB_SHA")
echo "SHORT_SHA=${short_sha}" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: raspberry-pi-pico-${{ env.SHORT_SHA }}
path: |
debug-raspberry-pi-pico-*.vsix
raspberry-pi-pico-*.vsix
ovsx-raspberry-pi-pico-*.vsix
- name: Add Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
debug-raspberry-pi-pico-*.vsix
raspberry-pi-pico-*.vsix
ovsx-raspberry-pi-pico-*.vsix
- name: Publish Extension
if: startsWith(github.ref, 'refs/tags/')
env:
VSCE_PAT: ${{ secrets.VSCODE_MARKETPLACE_PAT }}
run: |
vsce publish -i raspberry-pi-pico-*.vsix
- name: Publish Extension to OVSX
if: startsWith(github.ref, 'refs/tags/')
run: |
npx ovsx publish ovsx-raspberry-pi-pico-*.vsix -p ${{ secrets.OPEN_VSX_PAT }}