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