Bump Version, Create Tag, and Release #3
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: Bump Version, Create Tag, and Release | |
on: | |
workflow_dispatch: | |
inputs: | |
versionBump: | |
description: 'Version bump type' | |
required: true | |
default: 'minor' | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
env: | |
MARKET_TOKEN: ${{ secrets.MARKETPLACE_ACCESS_TOKEN }} | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
- name: Install dependencies | |
run: npm ci | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
- name: Upgrade package version and create tag | |
run: npm version ${{ github.event.inputs.versionBump }} -m "Upgrade to %s" | |
- name: Push changes | |
run: | | |
git push | |
git push --tags | |
- name: Get version and name from package.json | |
id: package_info | |
run: | | |
echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
echo "name=$(node -p "require('./package.json').name")" >> $GITHUB_ENV | |
- name: Package VS Code extension | |
run: npx vsce package | |
- name: Create GitHub release and upload VSIX | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: '${{ env.name }}-${{ env.version }}.vsix' | |
tag_name: v${{ env.version }} | |
name: Release ${{ env.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish to Visual Studio Marketplace | |
run: npx vsce publish -p "$MARKET_TOKEN" --packagePath '${{ env.name }}-${{ env.version }}.vsix' |