-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (109 loc) · 3.58 KB
/
publish.yml
File metadata and controls
128 lines (109 loc) · 3.58 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
name: Publish to Marketplace
on:
workflow_dispatch:
inputs:
version:
description: "Version to publish (e.g., 0.1.0)"
required: true
type: string
release:
types: [published]
jobs:
build:
name: Build Extension
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Compile extension
run: npm run compile
- name: Lint
run: npm run lint
- name: Type check
run: npx tsc --noEmit
- name: Format check
run: npm run format:check
- name: Smoke test
run: npm run smoke
- name: Verify version matches package.json
if: github.event_name == 'workflow_dispatch'
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
INPUT_VERSION="${{ github.event.inputs.version }}"
if [ "$PACKAGE_VERSION" != "$INPUT_VERSION" ]; then
echo "Error: package.json version ($PACKAGE_VERSION) does not match input version ($INPUT_VERSION)"
exit 1
fi
- name: Verify tag matches package.json
if: github.event_name == 'release'
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
TAG_VERSION="${{ github.event.release.tag_name }}"
TAG_VERSION=${TAG_VERSION#v}
if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then
echo "Error: package.json version ($PACKAGE_VERSION) does not match tag version ($TAG_VERSION)"
exit 1
fi
- name: Package extension
run: npx vsce package --allow-missing-repository
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: vsix-package
path: "*.vsix"
retention-days: 7
publish-vscode:
name: Publish to VS Code Marketplace
needs: build
runs-on: ubuntu-latest
steps:
- name: Download VSIX artifact
uses: actions/download-artifact@v4
with:
name: vsix-package
- name: Install vsce
run: npm install -g @vscode/vsce
- name: Publish to VS Code Marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: |
if [ -z "$VSCE_PAT" ]; then
echo "Error: VSCE_PAT secret is not set"
echo "Please create a Personal Access Token at https://dev.azure.com/_usersSettings/tokens"
echo "Then add it as a secret named VSCE_PAT in your repository settings"
exit 1
fi
VSIX_FILE=$(ls *.vsix)
vsce publish --packagePath "$VSIX_FILE" -p $VSCE_PAT
publish-openvsx:
name: Publish to Open VSX
needs: build
runs-on: ubuntu-latest
steps:
- name: Download VSIX artifact
uses: actions/download-artifact@v4
with:
name: vsix-package
- name: Install ovsx
run: npm install -g ovsx
- name: Publish to Open VSX
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
run: |
if [ -z "$OVSX_PAT" ]; then
echo "Error: OVSX_PAT secret is not set"
echo "Please create a Personal Access Token at https://open-vsx.org/user-settings/tokens"
echo "Then add it as a secret named OVSX_PAT in your repository settings"
exit 1
fi
VSIX_FILE=$(ls *.vsix)
ovsx publish "$VSIX_FILE" -p $OVSX_PAT