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.
This commit is contained in:
Andrew Eisenberg
2021-01-08 14:39:44 -08:00
parent 7b439e4511
commit 696c16b5b4
5 changed files with 87 additions and 12 deletions

45
.github/workflows/publish-open-vsx.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
# Publish the extension to the open-vsx registry at https://open-vsx.org
name: Publish Open VSX
on:
workflow_dispatch:
jobs:
publish:
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '10.18.1'
- name: Install dependencies
run: |
cd extensions/ql-vscode
npm install
shell: bash
- name: Build
run: |
cd extensions/ql-vscode
npm run build -- --release
shell: bash
- name: Prepare artifacts
id: prepare-artifacts
run: |
mkdir artifacts
cp dist/*.vsix artifacts
VSIX_PATH="$(ls artifacts/*.vsix)"
echo "::set-output name=vsix_path::$VSIX_PATH"
- name: Publish to Registry
env:
VSIX_PATH: ${{ steps.prepare-artifacts.outputs.vsix_path }}
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}
run: |
cd extensions/ql-vscode
npx ovsx publish $VSIX_PATH -p $OPEN_VSX_TOKEN

View File

@@ -32,7 +32,7 @@ jobs:
- name: Install dependencies
run: |
cd extensions/ql-vscode
npm install
npm ci
shell: bash
- name: Build
@@ -55,9 +55,6 @@ jobs:
REF_NAME="$(echo ${{ github.ref }} | sed -e 's:^refs/tags/::' | sed -e 's:/:-:g')"
echo "::set-output name=ref_name::$REF_NAME"
# Uploading artifacts is not necessary to create a release.
# This is just in case the release itself fails and we want to access the built artifacts from Actions.
# TODO Remove if not useful.
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
@@ -126,3 +123,37 @@ jobs:
body: This PR was automatically generated by the GitHub Actions release workflow in this repository.
branch: ${{ format('version/bump-to-{0}', steps.bump-patch-version.outputs.next_version) }}
base: main
vscode-publish:
name: Publish to VS Code Marketplace
needs: build
environment: publish
runs-on: ubuntu-latest
env:
VSCE_TOKEN: ${{ secrets.VSCE_TOKEN }}
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: vscode-codeql-extension
- name: Publish to Registry
run: |
npx vsce publish -p $VSCE_TOKEN --packagePath *.vsix
open-vsx-publish:
name: Publish to Open VSX Registry
needs: build
environment: publish
runs-on: ubuntu-latest
env:
OPEN_VSX_TOKEN: ${{ secrets.OPEN_VSX_TOKEN }}
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: vscode-codeql-extension
- name: Publish to Registry
run: |
npx ovsx publish -p $OPEN_VSX_TOKEN *.vsix

View File

@@ -114,10 +114,9 @@ Alternatively, you can run the tests inside of vscode. There are several vscode
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.
1. Unzip the `.vsix` and inspect its `package.json` to make sure the version is what you expect,
or look at the source if there's any doubt the right code is being shipped.
1. Log into the [Visual Studio Marketplace](https://marketplace.visualstudio.com/manage/publishers/github).
1. Click the `...` menu in the CodeQL row and click **Update**.
1. Drag the `.vsix` file you downloaded from the GitHub release into the Marketplace and click **Upload**.
1. Go to the draft GitHub release, click 'Edit', add some summary description, and publish it.
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).
1. Approve the deployments of the correct Release workflow. This will automatically publish to Open VSX and VS Code Marketplace.
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.
1. Confirm the new release is marked as the latest release at <https://github.com/github/vscode-codeql/releases>.
1. If documentation changes need to be published, notify documentation team that release has been made.
1. Review and merge the version bump PR that is automatically created by Actions.

View File

@@ -217,9 +217,9 @@
"dev": true
},
"@types/fs-extra": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.3.tgz",
"integrity": "sha512-NKdGoXLTFTRED3ENcfCsH8+ekV4gbsysanx2OPbstXVV6fZMgUCqTxubs6I9r7pbOJbFgVq1rpFtLURjKCZWUw==",
"version": "9.0.6",
"resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-9.0.6.tgz",
"integrity": "sha512-ecNRHw4clCkowNOBJH1e77nvbPxHYnWIXMv1IAoG/9+MYGkgoyr3Ppxr7XYFNL41V422EDhyV4/4SSK8L2mlig==",
"dev": true,
"requires": {
"@types/node": "*"

View File

@@ -746,7 +746,7 @@
"@types/chai-as-promised": "~7.1.2",
"@types/child-process-promise": "^2.2.1",
"@types/classnames": "~2.2.9",
"@types/fs-extra": "^9.0.3",
"@types/fs-extra": "^9.0.6",
"@types/glob": "^7.1.1",
"@types/google-protobuf": "^3.2.7",
"@types/gulp": "^4.0.6",