Update README.md #322
Workflow file for this run
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: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
type: | |
description: 'Release type (major/minor/patch)' | |
default: 'patch' | |
required: true | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Exit if workflow_dispatch on other branch than main | |
if: (github.event_name == 'workflow_dispatch') && (github.ref_name != 'refs/heads/main') | |
run: | | |
echo "Release workflow should be runned from main branch, exiting." | |
exit 1 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Setup Git | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Install dependencies | |
run: npm ci | |
# Only runs on release | |
- name: Set release version | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
npm version ${{ github.event.inputs.type }} | |
echo version=$(node -p "require('./package.json').version") >> $GITHUB_ENV | |
- name: Package | |
run: npm run package | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: vscode-vsix | |
path: "*.vsix" | |
retention-days: 5 | |
# All tasks below only run on release | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
tags: true | |
branch: main | |
- name: Upload release | |
uses: softprops/action-gh-release@v1 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
tag_name: "v${{ env.version }}" | |
files: "*.vsix" |