Build and deploy extension #5
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
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: Whether the extension should be published to the extension registries. | |
type: boolean | |
default: false | |
version: | |
description: The SemVer version for this Build | |
required: true | |
default: "0.0.0" | |
type: string | |
name: Build and deploy extension | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
vsixPath: ${{ steps.packageExtension.outputs.vsixPath }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm ci && cd webview-ui && npm ci | |
- name: Package Extension | |
id: packageExtension | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: stub | |
dryRun: true | |
- name: Upload Extension Package as Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: vsix | |
path: ${{ steps.packageExtension.outputs.vsixPath }} | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Download Build Artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: vsix | |
- name: Publish to Visual Studio Marketplace | |
if: ${{ github.event.inputs.publish == 'true' }} | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} | |
extensionFile: ${{ needs.build-lint-test.outputs.vsixPath }} | |
registryUrl: https://marketplace.visualstudio.com | |
- name: Publish to Open VSX Registry | |
if: ${{ github.event.inputs.publish == 'true' }} | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: ${{ secrets.OPEN_VSX_TOKEN }} | |
extensionFile: ${{ needs.build-lint-test.outputs.vsixPath }} |