Skip to content

Release

Release #16

Workflow file for this run

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/checkout@v4.1.4'
with:
persist-credentials: false
fetch-depth: 0
- name: 'Setup Node.js'
uses: 'actions/setup-node@v4.0.2'
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 "florian-edelmann@online.de"
- 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/release-action@v1.14.0'
with:
tag: 'v${{ env.VERSION_NUMBER }}'
name: 'Version ${{ env.VERSION_NUMBER }}'
generateReleaseNotes: true
draft: true