Skip to content

Commit

Permalink
ci: Build the VSCode extension using GitHub Actions (#364)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
3 people committed Apr 19, 2024
1 parent af00440 commit 8972b0e
Show file tree
Hide file tree
Showing 8 changed files with 2,143 additions and 52 deletions.
23 changes: 0 additions & 23 deletions .bazelci/presubmit.yml

This file was deleted.

1 change: 0 additions & 1 deletion .bazelrc

This file was deleted.

60 changes: 60 additions & 0 deletions .github/workflows/build.yml
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 }}
3 changes: 0 additions & 3 deletions BUILD

This file was deleted.

16 changes: 3 additions & 13 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand All @@ -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 <fwe@google.com> 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 <fwe@google.com> has handled recent versions.
1 change: 0 additions & 1 deletion WORKSPACE

This file was deleted.

Loading

0 comments on commit 8972b0e

Please sign in to comment.