name: release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
workflow_dispatch:
inputs:
tag:
description: "tag to release (e.g. 0.1.0)"
required: true
permissions:
contents: write
jobs:
release:
name: release ${{ github.event.inputs.tag || github.ref_name }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.inputs.tag || github.ref }}
- name: Generate changelog
id: cliff
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --latest --strip header
- name: Publish release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
name: ${{ github.event.inputs.tag || github.ref_name }}
body: ${{ steps.cliff.outputs.content }}
draft: false
prerelease: ${{ contains(github.event.inputs.tag || github.ref_name, '-') }}