-
Notifications
You must be signed in to change notification settings - Fork 9
48 lines (42 loc) · 1.31 KB
/
release.yml
File metadata and controls
48 lines (42 loc) · 1.31 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check if stable release
id: check
run: |
# align with build-docker.yml: stable only for strict semver tags
if [[ "${{ github.ref_name }}" =~ ^v(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then
echo "stable=true" >> "$GITHUB_OUTPUT"
else
echo "stable=false" >> "$GITHUB_OUTPUT"
fi
- name: Extract changelog
id: changelog
run: |
tag="${{ github.ref_name }}"
body=$(sed -n "/^\# .*\[${tag}\]/,/^\# .*\[v/{/^\# .*\[v/!p}" CHANGELOG.md || true)
cat >> "$GITHUB_OUTPUT" <<DELIM
body<<EOF
${body}
**Full Changelog**: https://github.com/${{ github.repository }}/blob/${tag}/CHANGELOG.md
EOF
DELIM
- name: Create release
uses: softprops/action-gh-release@v2
with:
body: ${{ steps.changelog.outputs.body }}
draft: false
prerelease: ${{ steps.check.outputs.stable != 'true' }}
make_latest: ${{ steps.check.outputs.stable == 'true' }}