-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (63 loc) · 1.95 KB
/
release.yml
File metadata and controls
70 lines (63 loc) · 1.95 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Release
permissions:
contents: read
# description: |
# Build a github release on either pushed tag or a manual workflow call.
#
# At this moment, the only available asset is a release note.
on:
workflow_call:
inputs:
tag:
type: string
required: true
jobs:
gh-release:
name: Create release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
-
name: Extract tag message
id: get-message
# tag message is not retrieved unless we fetch the ref explictly
run: |
set -x
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
MESSAGE=$(git tag -l '${{ inputs.tag }}' --format='%(contents:subject)
%(contents:body)
')
export MESSAGE
{
echo "message<<EOF"
printenv MESSAGE
echo 'EOF'
} >> "${GITHUB_OUTPUT}"
echo "Message in git tag ${{ inputs.tag }}"
echo "$MESSAGE"
-
name: Generate release notes
# this uses git-cliff to generate a release note from the commit history
id: notes
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPO: ${{ github.repository }}
uses: orhun/git-cliff-action@d77b37db2e3f7398432d34b72a12aa3e2ba87e51 # v4.6.0
with:
config: '.cliff.toml'
args: >-
--current
--with-tag-message '${{ steps.get-message.outputs.message }}'
-
name: Create github release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
body: ${{ steps.notes.outputs.content }}
tag_name: ${{ inputs.tag }}
generate_release_notes: false # skip auto-generated release notes from github API