Skip to content

Release

Release #4

name: Release
on:
release:
types:
- published
workflow_dispatch:
inputs:
publishMS:
description: "Publish to the Microsoft Marketplace"
type: boolean
required: true
default: "true"
publishOVSX:
description: "Publish to Open VSX"
type: boolean
required: true
default: "true"
publishGH:
description: "Publish to GitHub Releases"
type: boolean
required: true
default: "true"
jobs:
package:
name: Package
runs-on: ubuntu-latest
outputs:
packageName: ${{ steps.setup.outputs.packageName }}
tag: ${{ steps.setup-tag.outputs.tag }}
version: ${{ steps.setup-tag.outputs.version }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm i
- name: Setup package path
id: setup
run: echo "packageName=$(node -e "console.log(require('./package.json').name + '-' + require('./package.json').version + '.vsix')")" >> "$GITHUB_OUTPUT"
- name: Package
run: |
npx vsce package --out ${{ steps.setup.outputs.packageName }}
- uses: actions/upload-artifact@v3
with:
name: ${{ steps.setup.outputs.packageName }}
path: ./${{ steps.setup.outputs.packageName }}
if-no-files-found: error
- name: Setup tag
id: setup-tag
run: |
$version = (Get-Content ./package.json -Raw | ConvertFrom-Json).version
Write-Host "tag: v$version"
Write-Host "tag=v$version" >> "$GITHUB_OUTPUT"
Write-Host "version=$version" >> "$GITHUB_OUTPUT"
shell: pwsh
publishMS:
name: Publish to VS marketplace
runs-on: ubuntu-latest
needs: package
if: github.event.inputs.publishMS == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
- name: Publish to VS marketplace
run: npx vsce publish --packagePath ./${{ needs.package.outputs.packageName }} -p ${{ secrets.VSCE_PAT }}
publishOVSX:
name: Publish to Open VSX
runs-on: ubuntu-latest
needs: package
if: github.event.inputs.publishOVSX == 'true'
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
- name: Publish to Open VSX
run: npx ovsx publish ./${{ needs.package.outputs.packageName }} -p ${{ secrets.OVSX_PAT }}
publishGH:
name: Publish to GitHub releases
runs-on: ubuntu-latest
permissions:
contents: write
needs: package
if: github.event.inputs.publishGH == 'true'
steps:
- uses: actions/download-artifact@v3
with:
name: ${{ needs.package.outputs.packageName }}
- name: Create Release
id: create-release
uses: softprops/action-gh-release@v1
with:
files: ${{ needs.package.outputs.packageName }}
tag_name: ${{ needs.package.outputs.tag }}
release: Release ${{ needs.package.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true