Skip to content

Commit 696c16b

Browse files
committed
Add workflow jobs to deploy extension
This adds two new jobs to the `Release` workflow. These jobs are blocked behind an environment. When approved by a committer, the extension will be deployed to Open VSX and VS Code marketplace. Also, update contributing docs for open-vsx publishing.
1 parent 7b439e4 commit 696c16b

5 files changed

Lines changed: 87 additions & 12 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Publish the extension to the open-vsx registry at https://open-vsx.org
2+
3+
name: Publish Open VSX
4+
on:
5+
workflow_dispatch:
6+
7+
jobs:
8+
publish:
9+
name: Publish
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
15+
- uses: actions/setup-node@v1
16+
with:
17+
node-version: '10.18.1'
18+
19+
- name: Install dependencies
20+
run: |
21+
cd extensions/ql-vscode
22+
npm install
23+
shell: bash
24+
25+
- name: Build
26+
run: |
27+
cd extensions/ql-vscode
28+
npm run build -- --release
29+
shell: bash
30+
31+
- name: Prepare artifacts
32+
id: prepare-artifacts
33+
run: |
34+
mkdir artifacts
35+
cp dist/*.vsix artifacts
36+
VSIX_PATH="$(ls artifacts/*.vsix)"
37+
echo "::set-output name=vsix_path::$VSIX_PATH"
38+
39+
- name: Publish to Registry
40+
env:
41+
VSIX_PATH: ${{ steps.prepare-artifacts.outputs.vsix_path }}
42+
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}
43+
run: |
44+
cd extensions/ql-vscode
45+
npx ovsx publish $VSIX_PATH -p $OPEN_VSX_TOKEN

.github/workflows/release.yml

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
- name: Install dependencies
3333
run: |
3434
cd extensions/ql-vscode
35-
npm install
35+
npm ci
3636
shell: bash
3737

3838
- name: Build
@@ -55,9 +55,6 @@ jobs:
5555
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:^refs/tags/::' | sed -e 's:/:-:g')"
5656
echo "::set-output name=ref_name::$REF_NAME"
5757
58-
# Uploading artifacts is not necessary to create a release.
59-
# This is just in case the release itself fails and we want to access the built artifacts from Actions.
60-
# TODO Remove if not useful.
6158
- name: Upload artifacts
6259
uses: actions/upload-artifact@v2
6360
with:
@@ -126,3 +123,37 @@ jobs:
126123
body: This PR was automatically generated by the GitHub Actions release workflow in this repository.
127124
branch: ${{ format('version/bump-to-{0}', steps.bump-patch-version.outputs.next_version) }}
128125
base: main
126+
127+
vscode-publish:
128+
name: Publish to VS Code Marketplace
129+
needs: build
130+
environment: publish
131+
runs-on: ubuntu-latest
132+
env:
133+
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
134+
steps:
135+
- name: Download artifact
136+
uses: actions/download-artifact@v2
137+
with:
138+
name: vscode-codeql-extension
139+
140+
- name: Publish to Registry
141+
run: |
142+
npx vsce publish -p $VSCE_TOKEN --packagePath *.vsix
143+
144+
open-vsx-publish:
145+
name: Publish to Open VSX Registry
146+
needs: build
147+
environment: publish
148+
runs-on: ubuntu-latest
149+
env:
150+
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}
151+
steps:
152+
- name: Download artifact
153+
uses: actions/download-artifact@v2
154+
with:
155+
name: vscode-codeql-extension
156+
157+
- name: Publish to Registry
158+
run: |
159+
npx ovsx publish -p $OPEN_VSX_TOKEN *.vsix

CONTRIBUTING.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ Alternatively, you can run the tests inside of vscode. There are several vscode
114114
1. Download the VSIX from the draft GitHub release at the top of [the releases page](https://github.com/github/vscode-codeql/releases) that is created when the release build finishes.
115115
1. Unzip the `.vsix` and inspect its `package.json` to make sure the version is what you expect,
116116
or look at the source if there's any doubt the right code is being shipped.
117-
1. Log into the [Visual Studio Marketplace](https://marketplace.visualstudio.com/manage/publishers/github).
118-
1. Click the `...` menu in the CodeQL row and click **Update**.
119-
1. Drag the `.vsix` file you downloaded from the GitHub release into the Marketplace and click **Upload**.
120-
1. Go to the draft GitHub release, click 'Edit', add some summary description, and publish it.
117+
1. Go to the actions tab of the vscode-codeql repository and select the [Release workflow](https://github.com/github/vscode-codeql/actions?query=workflow%3ARelease).
118+
1. Approve the deployments of the correct Release workflow. This will automatically publish to Open VSX and VS Code Marketplace.
119+
1. Go to the draft GitHub release in [the releases tab of the repository](https://github.com/github/vscode-codeql/releases), click 'Edit', add some summary description, and publish it.
121120
1. Confirm the new release is marked as the latest release at <https://github.com/github/vscode-codeql/releases>.
122121
1. If documentation changes need to be published, notify documentation team that release has been made.
123122
1. Review and merge the version bump PR that is automatically created by Actions.

extensions/ql-vscode/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.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@
746746
"@types/chai-as-promised": "~7.1.2",
747747
"@types/child-process-promise": "^2.2.1",
748748
"@types/classnames": "~2.2.9",
749-
"@types/fs-extra": "^9.0.3",
749+
"@types/fs-extra": "^9.0.6",
750750
"@types/glob": "^7.1.1",
751751
"@types/google-protobuf": "^3.2.7",
752752
"@types/gulp": "^4.0.6",

0 commit comments

Comments
 (0)