Skip to content

fix: publish workflow (#5) #2

fix: publish workflow (#5)

fix: publish workflow (#5) #2

Workflow file for this run

name: 🚀 Publish to the Visual Studio Marketplace
on:
push:
branches:
- main
workflow_dispatch:
inputs:
version:
description: The version to release (e.g. x.x.x or major, minor, patch)
required: false
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check it
uses: actions/checkout@v4
- name: Prepare it
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install it
run: npm clean-install
- name: Version it
if: ${{ github.event_name == 'workflow_dispatch' }} && ${{ github.event.inputs.version }}
run: npm version ${{ github.event.inputs.version }} --no-git-tag-version
- name: Package it
id: package
run: |
npm exec vsce package
echo "filename=$(ls *.vsix)" >> $GITHUB_OUTPUT
- name: Publish it
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: npm exec vsce publish -- --packagePath ${{ steps.package.outputs.filename }}
- name: Configure it
id: config
run: |
echo "version=$(node --print "require('./package.json').version")" >> $GITHUB_OUTPUT
echo "preview=$(node --print "require('./package.json').preview")" >> $GITHUB_OUTPUT
- name: Release it
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.config.outputs.version }}
release_name: v${{ steps.config.outputs.version }}
prerelease: ${{ steps.config.outputs.preview }}
body: |
# v${{ steps.config.outputs.version }}
see [CHANGELOG.md](CHANGELOG.md) for details on this release
- name: Upload it
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.release.outputs.upload_url }}
asset_name: ${{ steps.package.outputs.filename }}
asset_path: ${{ steps.package.outputs.filename }}
asset_content_type: application/zip