Skip to content

Commit 86af18e

Browse files
authored
Update release workflow to allow publishing pre-releases to the VSCode Marketplace and OpenVSX (#777)
Both VSCode Marketplace and OpenVSX have a concept of "pre-releases", versions of an VSCode extension which can be published to these marketplaces but only installed for users who opt into receiving pre-release versions. Using this mechanism provides a more robust way of validating new changes to vscode-clangd before pushing them out to all users in a stable release. The workflow considers anything with an odd minor version number (e.g. 0.1.34) to be a pre-release, while anything with an even minor version number (e.g. 0.2.0) will be a stable release. This allows us to control the type of release by bumping the version number appropriately. Fixes #765
1 parent d095b50 commit 86af18e

File tree

4 files changed

+46
-8
lines changed

4 files changed

+46
-8
lines changed

.github/workflows/auto-release.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,51 @@ jobs:
1717
id: check
1818
with:
1919
diff-search: true # seach the diff content with version
20+
- if: steps.check.outputs.changed == 'true'
21+
id: is_preview
22+
run: |
23+
IFS='.' read -r -a array <<< "${{ steps.check.outputs.version }}"
24+
if [ $((array[1]%2)) -eq 0 ];
25+
then
26+
echo is_preview="false" >> "$GITHUB_OUTPUT"
27+
else
28+
echo is_preview="true" >> "$GITHUB_OUTPUT"
29+
fi
30+
shell: bash
2031
- if: steps.check.outputs.changed == 'true'
2132
run: npm ci
2233
- if: steps.check.outputs.changed == 'true'
2334
run: npm test
2435
- name: package
25-
if: steps.check.outputs.changed == 'true'
36+
if: steps.check.outputs.changed == 'true' && steps.is_preview.outputs.is_preview == 'false'
2637
run: npm run package
38+
- name: package
39+
if: steps.check.outputs.changed == 'true' && steps.is_preview.outputs.is_preview == 'true'
40+
run: npm run package-pre-release
2741
- name: publish to Github
2842
uses: ncipollo/release-action@v1
2943
if: steps.check.outputs.changed == 'true'
3044
with:
3145
artifacts: "vscode-clangd-*.vsix"
3246
tag: ${{ steps.check.outputs.version }}
3347
commit: ${{ steps.check.outputs.commit }}
48+
prerelease: ${{ steps.is_preview.outputs.is_preview }}
3449
token: ${{ secrets.GITHUB_TOKEN }}
3550
- name: publish to VSCode Marketplace
36-
if: steps.check.outputs.changed == 'true'
51+
if: steps.check.outputs.changed == 'true' && steps.is_preview.outputs.is_preview == 'false'
3752
# The token will expire. Regenerate it at:
3853
# https://llvm-vs-code-extensions.visualstudio.com/_usersSettings/tokens.
3954
run: npm run publish -- -p "${{ secrets.VSCODE_MARKETPLACE_TOKEN }}"
55+
- name: publish to VSCode Marketplace
56+
if: steps.check.outputs.changed == 'true' && steps.is_preview.outputs.is_preview == 'true'
57+
run: npm run publish-pre-release -- -p "${{ secrets.VSCODE_MARKETPLACE_TOKEN }}"
4058
- name: publish to OpenVSX
41-
if: steps.check.outputs.changed == 'true'
59+
if: steps.check.outputs.changed == 'true' && steps.is_preview.outputs.is_preview == 'false'
4260
# The token will expire. Regenerate it at:
4361
# https://open-vsx.org/user-settings/tokens
4462
run: npm run publish-openvsx -- -p "${{ secrets.OPENVSX_TOKEN }}"
63+
- name: publish to OpenVSX
64+
if: steps.check.outputs.changed == 'true' && steps.is_preview.outputs.is_preview == 'true'
65+
# The token will expire. Regenerate it at:
66+
# https://open-vsx.org/user-settings/tokens
67+
run: npm run publish-openvsx-pre-release -- -p "${{ secrets.OPENVSX_TOKEN }}"

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Change Log
22

3+
## Version 0.1.34: March 15, 2025
4+
5+
* Create pre-release flows [#748](https://github.com/clangd/vscode-clangd/issues/748) [#753](https://github.com/clangd/vscode-clangd/issues/753) [#765](https://github.com/clangd/vscode-clangd/issues/765)
6+
* Clean up disposables in early-return path of ClangdContext.create() [#743](https://github.com/clangd/vscode-clangd/issues/743)
7+
* Publish API package to the default registry [#746](https://github.com/clangd/vscode-clangd/issues/746)
8+
* Documentation
9+
* Mention the clangd config file in the README [#752](https://github.com/clangd/vscode-clangd/issues/752)
10+
* Mention the editor.defaultFormatter setting [#768](https://github.com/clangd/vscode-clangd/issues/768)
11+
* Add an option to allow "clangd.path" to point to a shell script [#683](https://github.com/clangd/vscode-clangd/issues/683)
12+
* Automatically restart clangd language server after it is installed [#749](https://github.com/clangd/vscode-clangd/issues/749)
13+
* Handle workspace symbols searches with a '::' prefix [#769](https://github.com/clangd/vscode-clangd/issues/769)
14+
315
## Version 0.1.33: November 21, 2024
416

517
* Reverted [#730](https://github.com/clangd/vscode-clangd/pull/730) for causing [#734](https://github.com/clangd/vscode-clangd/issues/734)

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-clangd",
33
"displayName": "clangd",
44
"description": "C/C++ completion, navigation, and insights",
5-
"version": "0.1.33",
5+
"version": "0.1.34",
66
"publisher": "llvm-vs-code-extensions",
77
"license": "MIT",
88
"homepage": "https://clangd.llvm.org/",
@@ -44,6 +44,9 @@
4444
"package": "vsce package --baseImagesUrl https://raw.githubusercontent.com/clangd/vscode-clangd/master/",
4545
"publish": "vsce publish --baseImagesUrl https://raw.githubusercontent.com/clangd/vscode-clangd/master/",
4646
"publish-openvsx": "ovsx publish --baseImagesUrl https://raw.githubusercontent.com/clangd/vscode-clangd/master/",
47+
"package-pre-release": "vsce package --pre-release --baseImagesUrl https://raw.githubusercontent.com/clangd/vscode-clangd/master/",
48+
"publish-pre-release": "vsce publish --pre-release --baseImagesUrl https://raw.githubusercontent.com/clangd/vscode-clangd/master/",
49+
"publish-openvsx-pre-release": "ovsx publish --pre-release --baseImagesUrl https://raw.githubusercontent.com/clangd/vscode-clangd/master/",
4750
"git-clang-format": "git-clang-format --extensions=ts"
4851
},
4952
"dependencies": {
@@ -404,4 +407,4 @@
404407
]
405408
}
406409
}
407-
}
410+
}

0 commit comments

Comments
 (0)