Skip to content

Release

Release #14

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
release-type:
description: "Release type"
required: true
type: choice
options:
- patch
- minor
- major
jobs:
publish:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm ci
- name: Git configuration
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions"
- name: Bump Version
id: bump_version
env:
RELEASE_TYPE: ${{ github.event.inputs.release-type }}
run: |
VERSION=$(npm version $RELEASE_TYPE)
git commit --amend -m "chore: release $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin && git push --tags
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.bump_version.outputs.version }}
body: |
Please refer to [CHANGELOG.md](https://github.com/otto-de/api-guidelines/blob/main/changes/changelog.md) for details.
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npm publish