Release #16
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' | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseType: | |
description: 'Release type' | |
required: true | |
default: 'minor' | |
type: 'choice' | |
options: | |
- 'major' | |
- 'minor' | |
- 'patch' | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
permissions: | |
contents: 'write' | |
id-token: 'write' | |
jobs: | |
release: | |
name: 'Release' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: 'Checkout' | |
uses: 'actions/[email protected]' | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: 'Setup Node.js' | |
uses: 'actions/[email protected]' | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org/' | |
cache: 'npm' | |
- name: 'Install dependencies' | |
run: 'npm ci' | |
- name: 'Build' | |
run: 'npm run build' | |
- name: 'Setup git' | |
run: | | |
git config user.name "Flo Edelmann" | |
git config user.email "[email protected]" | |
- name: 'Bump ${{ github.event.inputs.releaseType }} version' | |
run: 'npm version ${{ github.event.inputs.releaseType }} --force -m "Version %s"' | |
- name: 'Release new version' | |
run: | | |
npm publish --provenance --access public | |
VERSION_NUMBER=$(git tag --list | tail -n 1 | cut -d v -f 2) | |
echo "VERSION_NUMBER=$VERSION_NUMBER" >> $GITHUB_ENV | |
env: | |
NODE_AUTH_TOKEN: '${{ secrets.NPM_API_TOKEN }}' | |
- name: 'Push changes' | |
uses: 'ad-m/github-push-action@master' | |
with: | |
github_token: '${{ secrets.GITHUB_TOKEN }}' | |
branch: '${{ github.ref }}' | |
tags: true | |
- name: 'Create GitHub Release' | |
uses: 'ncipollo/[email protected]' | |
with: | |
tag: 'v${{ env.VERSION_NUMBER }}' | |
name: 'Version ${{ env.VERSION_NUMBER }}' | |
generateReleaseNotes: true | |
draft: true |