-
Notifications
You must be signed in to change notification settings - Fork 3
53 lines (47 loc) · 1.54 KB
/
deploy.yml
File metadata and controls
53 lines (47 loc) · 1.54 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
name: Deploy
on:
push:
tags: ['v*']
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Extract changelog for this version
id: changelog
run: |
TAG="${GITHUB_REF#refs/tags/}"
# Extract the section for this version from CHANGELOG.md
BODY=$(awk "/^## \\[${TAG}\\]/{found=1; next} /^## \\[/{if(found) exit} found{print}" CHANGELOG.md)
if [ -z "$BODY" ]; then
echo "No changelog entry found for ${TAG}, using auto-generated notes"
echo "use_auto=true" >> $GITHUB_OUTPUT
else
# Write body to file to preserve multiline content
echo "$BODY" > /tmp/release-body.md
echo "use_auto=false" >> $GITHUB_OUTPUT
fi
- name: Create Release (from changelog)
if: steps.changelog.outputs.use_auto == 'false'
uses: softprops/action-gh-release@v3
with:
body_path: /tmp/release-body.md
files: LICENSE
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release (auto-generated)
if: steps.changelog.outputs.use_auto == 'true'
uses: softprops/action-gh-release@v3
with:
files: LICENSE
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}