-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (54 loc) · 1.76 KB
/
Copy pathrefresh-release-notes.yml
File metadata and controls
68 lines (54 loc) · 1.76 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
name: Refresh release notes
# Rewrite an existing GitHub Release body without rebuilding.
# Run from Actions → Refresh release notes when polishing notes only.
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag to refresh (e.g. v1.0.4)'
required: true
type: string
permissions:
contents: write
jobs:
refresh:
name: Rewrite release body
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Rewrite notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.event.inputs.tag }}
run: |
set -euo pipefail
VER="${TAG#v}"
cat > /tmp/notes-header.md <<'EOF'
## Install (Arch / CachyOS)
```bash
git clone --recursive https://github.com/byrdltd/whyLIAN.git
cd whyLIAN
git checkout TAG
./install.sh
systemctl --user enable --now lianli-daemon
sudo loginctl enable-linger $USER
```
User-local install: `./install.sh --user`
Read [DISCLAIMER.md](https://github.com/byrdltd/whyLIAN/blob/main/DISCLAIMER.md) before installing.
---
EOF
sed -i "s/TAG/${TAG}/g" /tmp/notes-header.md
{
echo "## Changelog"
awk -v ver="$VER" '
$0 ~ "^## \\[" ver "\\]" { found=1; print; next }
found && /^## \[/ { exit }
found { print }
' CHANGELOG.md
} > /tmp/notes-body.md
cat /tmp/notes-header.md /tmp/notes-body.md > /tmp/notes.md
gh release edit "$TAG" --repo "$GITHUB_REPOSITORY" \
--title "whyLIAN ${TAG}" \
--notes-file /tmp/notes.md