Publish 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
name: Publish Extension | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: true | |
default: 'minor' | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Install Dependencies | |
run: | # vsce etc | |
npm i | |
- name: Setup Github Actions | |
run: | # allow use of `git push` | |
git config --global user.name "RedCMD" | |
git config --global user.email "[email protected]" | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Sync Github Actions" | |
- name: Package Extension | |
run: | # `.vsix` file | |
npx vsce package ${{ github.event.inputs.version }} | |
git push | |
git push --tags | |
echo "VERSION=$(node -p "require('./package.json').version")" >> "$GITHUB_ENV" | |
- name: Generate Release | |
run: | # create release page on github with `.vsix` file | |
gh release create v$VERSION --generate-notes json-embedded-languages-$VERSION.vsix | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Publish Release | |
run: | # upload to Extension Marketplace | |
npx vsce publish -p ${{ secrets.VSCE_PAT }} --packagePath json-embedded-languages-$VERSION.vsix |