-
-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (45 loc) · 1.4 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Release
on:
push:
tags:
- "v*.*.*"
jobs:
changelog:
name: Generate changelog
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.release.outputs.RELEASE_BODY }}
steps:
- name: Checkout
uses: actions/checkout@v3.5.2
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v2.0.6
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --strip all
env:
OUTPUT: CHANGES.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'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "::set-output name=RELEASE_BODY::$r"
# use release body in another job
publish:
name: Publish on the GitHub
needs: changelog
runs-on: ubuntu-latest
steps:
- name: Create the GitHub release
uses: softprops/action-gh-release@v0.1.15
with:
body: ${{ needs.changelog.outputs.release_body }}
prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-beta') || contains(github.ref, '-alpha') }}