Skip to content

Commit 2fcb6c6

Browse files
committed
ci: update publishing Action
1 parent 73f9c6c commit 2fcb6c6

File tree

1 file changed

+37
-9
lines changed

1 file changed

+37
-9
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,41 @@ jobs:
1212
with:
1313
node-version: 16
1414
- run: npm ci
15-
# - name: Publish to Open VSX Registry
16-
# uses: HaaLeo/publish-vscode-extension@v1
17-
# with:
18-
# pat: ${{ secrets.OPEN_VSX_TOKEN }}
19-
- name: Publish to Visual Studio Marketplace
20-
uses: HaaLeo/publish-vscode-extension@v1
15+
16+
# Package and publish the extension to VS Code Marketplace
17+
# Do not produce a git tag, only increment the version in package.json
18+
- name: Publish Release ${{ github.ref_name }}
19+
if: startsWith(github.ref, 'refs/tags/v')
20+
run: |
21+
npm i -g vsce
22+
if [ "$pre_release" = true ] ; then
23+
vsce publish --no-git-tag-version --pre-release ${GITHUB_REF_NAME:1}
24+
else
25+
vsce publish --no-git-tag-version ${GITHUB_REF_NAME:1}
26+
fi
27+
env:
28+
pre_release: ${{ github.event.release.prerelease }}
29+
30+
# Commit the new version to the repository default branch and update the tag
31+
# This removes the signing of the commit, tag and release since it's
32+
# created by the GitHub Actions bot
33+
- name: Update package.json version
34+
if: startsWith(github.ref, 'refs/tags/v')
35+
run: |
36+
git config user.name github-actions
37+
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
38+
git switch -c tmp
39+
git add package.json
40+
git commit -m "ci: update version to ${GITHUB_REF_NAME:1}"
41+
git fetch
42+
git switch main
43+
git merge tmp
44+
git tag -f $GITHUB_REF_NAME
45+
git push origin -f $GITHUB_REF_NAME
46+
git push origin -f main
47+
48+
# Upload the artifact as a release asset
49+
- uses: softprops/action-gh-release@master
50+
if: startsWith(github.ref, 'refs/tags/v')
2151
with:
22-
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
23-
registryUrl: https://marketplace.visualstudio.com
24-
preRelease: ${{ github.event.release.prerelease }}
52+
files: ./*.vsix

0 commit comments

Comments
 (0)