99 publish :
1010 runs-on : ubuntu-latest
1111 permissions :
12- contents : write
12+ contents : write # Required for creating releases
1313
1414 steps :
1515 - name : Checkout
@@ -20,77 +20,41 @@ jobs:
2020 with :
2121 node-version : " 22"
2222
23- - name : Show Node/npm versions
24- run : node -v && npm -v
25-
26- - name : Cache root npm
27- uses : actions/cache@v4
28- with :
29- path : ~/.npm
30- key : ${{ runner.os }}-npm-cache-${{ hashFiles('package-lock.json') }}
31- restore-keys : ${{ runner.os }}-npm-cache-
32-
33- - name : Cache webview node_modules
34- uses : actions/cache@v4
35- with :
36- path : webview-ui/node_modules
37- key : ${{ runner.os }}-webview-node-modules-${{ hashFiles('webview-ui/package-lock.json') }}
38- restore-keys : ${{ runner.os }}-webview-node-modules-
39-
4023 - name : Extract version from tag
4124 run : |
4225 TAG=${GITHUB_REF##*/}
4326 VERSION=${TAG#v}
4427 echo "TAG=$TAG" >> $GITHUB_ENV
4528 echo "VERSION=$VERSION" >> $GITHUB_ENV
4629
47- - name : Show version
48- run : echo "Publishing version $VERSION (from tag $TAG)"
49-
5030 - name : Install dependencies
51- run : npm ci
52-
53- - name : Install webview dependencies
54- run : npm ci --prefix webview-ui
31+ run : |
32+ npm ci
33+ npm ci --prefix webview-ui
5534
5635 - name : Set package.json version
5736 run : npm version $VERSION --no-git-tag-version
5837
59- - name : Build all
60- run : npm run build:all
61-
62- # - name: Run tests
63- # run: npm test
64-
65- - name : Package .vsix
66- run : npx vsce package
38+ - name : Build and Package
39+ run : |
40+ npm run build:all
41+ npx vsce package
6742
6843 - name : Publish to Visual Studio Marketplace
6944 env :
7045 VSCE_TOKEN : ${{ secrets.VSCE_TOKEN }}
46+ # continue-on-error: true # Optional: Uncomment if you want the GitHub Release to happen even if Marketplace fails
7147 run : npx vsce publish --pat $VSCE_TOKEN --packagePath *.vsix
7248
73- - name : Create GitHub Release
74- id : create_release
75- uses : actions/create-release@v1
76- with :
77- tag_name : ${{ env.TAG }}
78- release_name : ${{ env.TAG }}
79- body : Release ${{ env.TAG }}
80- draft : false
81- prerelease : false
82- env :
83- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
84-
8549 - name : Create GitHub Release and Upload VSIX
8650 env :
8751 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
8852 run : |
89- # Finds the first .vsix file in the directory
9053 VSIX_FILE=$(ls *.vsix | head -n 1)
91-
92- # Uses GitHub CLI to create a release and attach the file in one go
54+
55+ # We use --clobber so if you delete a release and re-run the action, it can overwrite
9356 gh release create ${{ env.TAG }} \
9457 --title "${{ env.TAG }}" \
9558 --notes "Release for version ${{ env.VERSION }}" \
96- "$VSIX_FILE"
59+ --clobber \
60+ "$VSIX_FILE"
0 commit comments