@@ -2,44 +2,57 @@ name: Publish VS Code Extension
22
33on :
44 push :
5- branches :
6- - master
5+ tags :
6+ - ' vscode-v*.*.*'
7+ workflow_dispatch :
8+ inputs :
9+ version :
10+ description : ' VS Code extension version to publish, e.g. 0.4.1'
11+ required : true
12+ type : string
713
8- jobs :
9- check-changes :
10- runs-on : ubuntu-latest
11- outputs :
12- extension-changed : ${{ steps.filter.outputs.extension }}
13- steps :
14- - name : Checkout code
15- uses : actions/checkout@v4
16-
17- - name : Check for extension changes
18- uses : dorny/paths-filter@v3
19- id : filter
20- with :
21- filters : |
22- extension:
23- - 'vscode-pace/**'
14+ concurrency :
15+ group : vscode-extension-${{ github.ref }}
16+ cancel-in-progress : true
2417
18+ jobs :
2519 publish :
2620 runs-on : ubuntu-latest
27- needs : check-changes
28- if : needs.check-changes.outputs.extension-changed == 'true'
29-
21+
3022 steps :
3123 - name : Checkout code
3224 uses : actions/checkout@v4
3325
3426 - name : Setup Node.js
3527 uses : actions/setup-node@v4
3628 with :
37- node-version : ' 20'
29+ node-version : ' 24'
30+
31+ - name : Determine extension version
32+ id : version
33+ shell : bash
34+ run : |
35+ if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
36+ VERSION="${{ inputs.version }}"
37+ else
38+ VERSION="${GITHUB_REF_NAME#vscode-v}"
39+ fi
40+
41+ if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
42+ echo "Invalid version: $VERSION" >&2
43+ exit 1
44+ fi
45+
46+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
3847
3948 - name : Install dependencies
4049 working-directory : ./vscode-pace
4150 run : npm ci
4251
52+ - name : Set package version from release version
53+ working-directory : ./vscode-pace
54+ run : npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version
55+
4356 - name : Compile extension
4457 working-directory : ./vscode-pace
4558 run : npm run compile
0 commit comments