Skip to content

Commit 8972b0e

Browse files
vogelsgesangadam-azarchscameron-martin
authored
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 <adam.azarchs@10xgenomics.com> Co-authored-by: Cameron Martin <cameronmartin123@gmail.com>
1 parent af00440 commit 8972b0e

File tree

8 files changed

+2143
-52
lines changed

8 files changed

+2143
-52
lines changed

.bazelci/presubmit.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.bazelrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Build VS Code extension
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
types: [published]
8+
9+
permissions:
10+
# Write permissions needed for publishing the release
11+
contents: write
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
build_vscode_ext:
19+
name: Build VS Code extension
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Install Node.js
26+
uses: actions/setup-node@v4
27+
with:
28+
cache: "npm"
29+
30+
- name: Install Javascript dependencies
31+
run: npm ci
32+
33+
- name: Check formatting
34+
run: npm run format-check
35+
36+
# Has to happen before `check-lint`, because we need the generated protobuf types
37+
- name: Compile the extension
38+
run: npm run compile
39+
40+
- name: Lint
41+
run: npm run check-lint
42+
43+
- name: Package VS Code extension
44+
run: npm run package
45+
46+
- name: Upload Workflow Artifact
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: vscode-bazel-prerelease.vsix
50+
path: vscode-bazel-*.vsix
51+
if-no-files-found: error
52+
53+
- name: Upload Release Artifact
54+
if: ${{ github.event_name == 'release' }}
55+
shell: bash
56+
run: |
57+
filename=`echo vscode-bazel-*.vsix`;
58+
gh release upload ${{ github.event.release.tag_name }} "$filename"
59+
env:
60+
GH_TOKEN: ${{ github.token }}

BUILD

Lines changed: 0 additions & 3 deletions
This file was deleted.

RELEASE.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,12 @@
22

33
Most of the releasing is done by [release please](https://github.com/googleapis/release-please), but there are still some manual steps required.
44

5-
## One-Time Setup
6-
7-
Make sure you have the `vsce` tool installed:
8-
9-
```
10-
$ npm install -g vsce
11-
```
12-
135
## Create and Test the .vsix Package
146

157
Check out the branch of the auto-generated release PR and, run the following command from the directory of the extension source code:
168

179
```
18-
$ vsce package
10+
$ npm run package
1911
```
2012

2113
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
3830

3931
We deploy the extension to **two** destinations:
4032

41-
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.
42-
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 <fwe@google.com> has handled recent versions.
43-
44-
You can now delete the .vsix file if you wish; it will not be used when publishing to the marketplace.
33+
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.
34+
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 <fwe@google.com> has handled recent versions.

WORKSPACE

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)