Skip to content

Publish

Publish #6

Workflow file for this run

# Publish package to marketplace when a Github release is published
# This action checks the tag matches the package version and then publishes the package to the marketplace
name: Publish
on:
release:
types: [released]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: setup node
uses: actions/setup-node@v2
with:
node-version: 18
- run: npm install
- name: match-tag-to-package-version
id: match-tag-to-package-version
uses: geritol/match-tag-to-package-version@0.2.0
with:
TAG_PREFIX: v # Optional, default prefix is ""
# TAG_PREFIX may also be defined under the 'env' key.
# Get the package name, stripping any v-prefix from the tag
- name: Get package name
run: |
VERSION=${GITHUB_REF_NAME#v}
FILENAME="beeb-vsc-$VERSION.vsix"
echo Version: $VERSION
echo Package: $PACKAGE_NAME
echo "PACKAGE_NAME=$FILENAME" >> $GITHUB_ENV
echo "PACKAGE_PATH=./$FILENAME" >> $GITHUB_ENV
- name: Build
run: npm run package
- name: Upload build artefact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ env.PACKAGE_PATH }}
asset_name: ${{ env.PACKAGE_NAME }}
asset_content_type: application/gzip
- name: Publish to Visual Studio Marketplace
uses: HaaLeo/publish-vscode-extension@v1
with:
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }}
packagePath: ${{ env.PACKAGE_PATH }}
registryUrl: https://marketplace.visualstudio.com