-
-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Build the VSCode extension using GitHub Actions (#364)
This commit adds a Github action which builds the VS Code extension. The .vsix file is uploaded as an artifact such that it can be easily downloaded from GitHub (in the "Artifacts" section of the action's summary page). Those artifacts are also uploaded as part of pull requests, which makes it easier to quickly download, install and test the extension built from a pull request. In addition, if the workflow is triggered because a new release was tagged, the .vsix is also attached as an artifact to the newly created release. As part of this change, the `vsce` tool is now listed as a devDependency and thereby its exact version is now part of the `package-lock.json`, making the packaging step more reproducible. The new, recommend way to package the extension is now `npm run package`. Co-authored-by: Adam Azarchs <[email protected]> Co-authored-by: Cameron Martin <[email protected]>
- Loading branch information
1 parent
af00440
commit 8972b0e
Showing
8 changed files
with
2,143 additions
and
52 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Build VS Code extension | ||
|
||
on: | ||
push: | ||
pull_request: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
# Write permissions needed for publishing the release | ||
contents: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build_vscode_ext: | ||
name: Build VS Code extension | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: "npm" | ||
|
||
- name: Install Javascript dependencies | ||
run: npm ci | ||
|
||
- name: Check formatting | ||
run: npm run format-check | ||
|
||
# Has to happen before `check-lint`, because we need the generated protobuf types | ||
- name: Compile the extension | ||
run: npm run compile | ||
|
||
- name: Lint | ||
run: npm run check-lint | ||
|
||
- name: Package VS Code extension | ||
run: npm run package | ||
|
||
- name: Upload Workflow Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: vscode-bazel-prerelease.vsix | ||
path: vscode-bazel-*.vsix | ||
if-no-files-found: error | ||
|
||
- name: Upload Release Artifact | ||
if: ${{ github.event_name == 'release' }} | ||
shell: bash | ||
run: | | ||
filename=`echo vscode-bazel-*.vsix`; | ||
gh release upload ${{ github.event.release.tag_name }} "$filename" | ||
env: | ||
GH_TOKEN: ${{ github.token }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,20 +2,12 @@ | |
|
||
Most of the releasing is done by [release please](https://github.com/googleapis/release-please), but there are still some manual steps required. | ||
|
||
## One-Time Setup | ||
|
||
Make sure you have the `vsce` tool installed: | ||
|
||
``` | ||
$ npm install -g vsce | ||
``` | ||
|
||
## Create and Test the .vsix Package | ||
|
||
Check out the branch of the auto-generated release PR and, run the following command from the directory of the extension source code: | ||
|
||
``` | ||
$ vsce package | ||
$ npm run package | ||
``` | ||
|
||
This will compile and bundle the extension into a file named `vscode-bazel-x.y.z.vsix`, where `x.y.z` is the version number of the extension as defined in `package.json`. | ||
|
@@ -38,7 +30,5 @@ To deploy the release, merge the auto-generated release PR. This will contain a | |
|
||
We deploy the extension to **two** destinations: | ||
|
||
1. We create a .vsix package to upload as a GitHub release, since this is a useful archiving method and it allows users to download and roll back to a previous version of the plugin if necessary. This can be done by anyone who is a maintainer on GitHub. This is done by attaching the `vscode-bazel-x.y.z.vsix` file to the auto-generated release by dragging it or selecting it in the upload box. | ||
2. We publish the extension to the Visual Studio Marketplace so that it can be found in search results and downloaded from Visual Studio Code's Extensions area. This requires publishing rights for the Bazel organization on the Visual Studio Marketplace. Florian Weikert <[email protected]> has handled recent versions. | ||
|
||
You can now delete the .vsix file if you wish; it will not be used when publishing to the marketplace. | ||
1. We create a .vsix package to upload as a GitHub release, since this is a useful archiving method and it allows users to download and roll back to a previous version of the plugin if necessary. This is automated by the "Build VS Code extension" GitHub workflow which will automatically run as soon as a new GitHub release gets created. | ||
2. We publish the extension to the Visual Studio Marketplace so that it can be found in search results and downloaded from Visual Studio Code's Extensions area. This is a manual step and requires publishing rights for the Bazel organization on the Visual Studio Marketplace. Florian Weikert <[email protected]> has handled recent versions. |
Oops, something went wrong.