chore: add workflow to generate changelog on v*-tags push

This commit is contained in:
bcakmakoglu
2022-06-15 19:59:08 +02:00
parent e55a3fbeb6
commit 87ad709e5e

View File

@@ -1,33 +1,33 @@
name: Generate changelog
on: workflow_dispatch
on:
push:
tags:
- 'v*'
jobs:
generate-changelog:
changelog:
name: Generate changelog
runs-on: ubuntu-20.04
outputs:
release_body: ${{ steps.release.outputs.release_body }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: cliff.toml
args: --output CHANGELOG.md
args: --verbose
env:
OUTPUT: CHANGELOG.md
- name: Set the release body
id: release
shell: bash
run: |
r=$(cat ${{ steps.git-cliff.outputs.changelog }})
r="$(printf "$r" | tail -n +3)"
r="${r//'%'/'%25'}"
r="${r//$'\n'/'%0A'}"
r="${r//$'\r'/'%0D'}"
echo "::set-output name=release_body::$r"
- name: Commit the changelog
uses: EndBug/add-and-commit@v9
with:
add: 'CHANGELOG.md'
author_name: Git Cliff
committer_name: Git Cliff
message: 'chore: update CHANGELOG.md'