π Release + Publish #45
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: Release + Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
versionChange: | |
type: choice | |
description: Select the version change | |
required: true | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
VERSION_CHANGE: ${{ github.event.inputs.versionChange }} | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Node.js βοΈ | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install node_modules π¦ | |
run: | | |
npm ci | |
npm install --global @vscode/vsce | |
- name: Update version β | |
run: | | |
git config --global user.name 'Philipp Kief' | |
git config --global user.email '[email protected]' | |
git config --global push.followTags true | |
npm version ${{ env.VERSION_CHANGE }} -m "Release %s" | |
- name: Get meta data π | |
run: | | |
NODE_VERSION=$(node -p -e "require('./package.json').version") | |
echo VERSION=$NODE_VERSION >> $GITHUB_ENV | |
NODE_NAME=$(node -p -e "require('./package.json').name") | |
echo NAME=$NODE_NAME >> $GITHUB_ENV | |
NODE_DISPLAY_NAME=$(node -p -e "require('./package.json').displayName") | |
echo DISPLAY_NAME=$NODE_DISPLAY_NAME >> $GITHUB_ENV | |
- name: Build βοΈ | |
run: vsce package | |
- name: Push tags π | |
run: git push | |
- name: Release ${{ env.VERSION }} π | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: ${{ env.NAME }}-${{ env.VERSION }}.vsix | |
tag_name: v${{ env.VERSION }} | |
name: ${{ env.DISPLAY_NAME }} v${{ env.VERSION }} | |
generate_release_notes: true | |
- name: Publish to Open VSX Registry π | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: ${{ secrets.OPEN_VSX_TOKEN }} | |
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix | |
- name: Publish to Visual Studio Marketplace π | |
uses: HaaLeo/publish-vscode-extension@v1 | |
with: | |
pat: ${{ secrets.VS_MARKETPLACE_TOKEN }} | |
registryUrl: https://marketplace.visualstudio.com | |
extensionFile: ${{ env.NAME }}-${{ env.VERSION }}.vsix | |
- name: Publish to NPM Registry π | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |