Skip to content

Build release and publish on VSCode's Marketplace and OpenVSX #3

Build release and publish on VSCode's Marketplace and OpenVSX

Build release and publish on VSCode's Marketplace and OpenVSX #3

Workflow file for this run

name: Build release and publish on VSCode's Marketplace and OpenVSX
on:
release:
types: [published]
# We need to have write permissions to add the vsix to the release assets
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
- name: Install dependencies
run: npm install
- name: Build the vsix
run: npx vsce package -o sarif-explorer.vsix
- uses: actions/upload-artifact@v4
with:
name: sarif-explorer.vsix
path: sarif-explorer.vsix
upload-asset:
runs-on: ubuntu-latest
needs: build
if: success()
permissions:
contents: write
steps:
- id: download
uses: actions/download-artifact@v4
with:
name: sarif-explorer.vsix
- name: Add vsix to the release assets
uses: actions/[email protected]
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ steps.download.outputs.download-path }}
asset_name: sarif-explorer.vsix
asset_content_type: application/octet-stream
publish:
runs-on: ubuntu-latest
needs: build
if: success()
steps:
- id: download
uses: actions/download-artifact@v4
with:
name: sarif-explorer.vsix
# Uncomment the following lines to also publish the extension on the VSCode Marketplace
# - name: Publish Extension on VSCode's Marketplace
# run: npx vsce publish --pat ${{ secrets.VSCODE_PUBLISHING_TOKEN }} --packagePath ${{ steps.download.outputs.download-path }}
- name: Publish Extension on OpenVSX
run: npx ovsx publish --pat ${{ secrets.OPENVSX_PUBLISHING_TOKEN }} --packagePath ${{ steps.download.outputs.download-path }}