Patrick Gehrsitz b85de7b0ab
chore: add release workflow (#194)
* chore: add release workflow

Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com>

* chore: fix GITHUB_TOKEN permissions

* chore: fix broken commit links

* chore: add post- and preprocessing for release workflow

* chore: update cliff action version

* chore: fix syntax error

* chore: fix PR url

* chore: bump to actions/checkout v4

---------

Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com>
2023-10-31 12:06:51 +01:00

92 lines
2.6 KiB
YAML

name: Release
on:
workflow_dispatch:
inputs:
version:
type: string
description: New version number in X.Y.Z
required: true
jobs:
update-master-branch:
runs-on: ubuntu-latest
steps:
- uses: everlytic/branch-merge@1.1.5
with:
github_token: ${{ secrets.PAT }}
source_ref: 'develop'
target_branch: 'master'
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'
release:
needs: [ 'update-master-branch' ]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Fetch repo
uses: actions/checkout@v4
with:
ref: 'master'
fetch-depth: 0
- name: Get latest tag
id: latest_tag
shell: bash
run: |
echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
id: generate-changelog
with:
config: ./cliff-release.toml
args: ${{ steps.latest_tag.outputs.TAG_NAME }}..HEAD
- name: Create release and upload build
uses: softprops/action-gh-release@v1
id: create-release
with:
name: v${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ steps.generate-changelog.outputs.content }}
update-changelog:
needs: [ 'release' ]
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: 'master'
token: ${{ secrets.PAT }}
fetch-depth: 0
- name: Get latest tag
id: latest_tag
shell: bash
run: |
echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
with:
config: cliff.toml
args: v0.0.0..${{ steps.latest_tag.outputs.TAG_NAME }}
env:
OUTPUT: ${{ github.workspace }}/CHANGELOG.md
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'docs(changelog): update changelog'
file_pattern: CHANGELOG.md
- uses: everlytic/branch-merge@1.1.5
with:
github_token: ${{ secrets.PAT }}
source_ref: 'master'
target_branch: 'develop'
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'