This repository was archived by the owner on Feb 15, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-release-notes.sh
More file actions
executable file
·145 lines (102 loc) · 4.09 KB
/
generate-release-notes.sh
File metadata and controls
executable file
·145 lines (102 loc) · 4.09 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash
# Generate release notes for a release
# Usage: generate-release-notes.sh <VERSION> <TAG_VERSION> <RELEASE_TYPE>
# RELEASE_TYPE: "prerelease", "draft", or "stable"
set -e
VERSION="${1:?Version required}"
TAG_VERSION="${2:?Tag version required}"
RELEASE_TYPE="${3:?Release type required}"
if [ -z "$VERSION" ] || [ -z "$TAG_VERSION" ] || [ -z "$RELEASE_TYPE" ]; then
echo "Usage: generate-release-notes.sh <VERSION> <TAG_VERSION> <RELEASE_TYPE>"
exit 1
fi
SHORT_SHA="${GITHUB_SHA:0:7}"
# Get the latest published (non-prerelease) release
LAST_TAG=$(gh release list --limit 100 --json tagName,isPrerelease,isDraft \
--jq '.[] | select(.isDraft == false and .isPrerelease == false) | .tagName' | head -n1)
if [ -n "$LAST_TAG" ]; then
echo "Generating changelog since $LAST_TAG"
CHANGELOG=$(git log "${LAST_TAG}"..HEAD --pretty=format:"- %s (%h)" --no-merges --)
else
echo "No previous published releases found, using recent commits"
CHANGELOG=$(git log -10 --pretty=format:"- %s (%h)" --no-merges)
fi
case "$RELEASE_TYPE" in
prerelease)
cat > release_notes.md <<EOF
## HALPI2 Daemon v${TAG_VERSION} (Pre-release)
⚠️ **This is a pre-release build from the main branch. Use for testing only.**
**Build Information:**
- Commit: ${SHORT_SHA} (\`${GITHUB_SHA}\`)
- Built: $(date -u '+%Y-%m-%d %H:%M:%S UTC')
### Recent Changes
${CHANGELOG}
### Installation
To install this pre-release on your HALPI2:
\`\`\`bash
# Add Hat Labs repository (if not already added)
curl -fsSL https://apt.hatlabs.fi/hat-labs-apt-key.asc | sudo gpg --dearmor -o /usr/share/keyrings/hatlabs-apt-key.gpg
# Add unstable channel
echo "deb [signed-by=/usr/share/keyrings/hatlabs-apt-key.gpg] https://apt.hatlabs.fi unstable main" | sudo tee /etc/apt/sources.list.d/hatlabs-unstable.list
# Update and install
sudo apt update
sudo apt install halpid
\`\`\`
EOF
;;
draft)
cat > release_notes.md <<EOF
## HALPI2 Daemon v${VERSION}
Power monitor and watchdog service for HALPI2 - the Raspberry Pi CM5 based boat computer.
### Changes
${CHANGELOG}
### Features
- **Blackout Reporting**: Monitor input voltage and detect power loss
- **Automatic Shutdown**: Trigger safe system shutdown when power isn't restored
- **Supercap Voltage Monitoring**: Track backup power status
- **Watchdog Functionality**: Automatic hard reset if communication fails
- **RTC Sleep Mode**: Schedule wake times for battery-powered operations
- **USB Power Control**: Power-cycle USB ports for unresponsive devices
### Installation
This is the source code release. For Debian packages:
\`\`\`bash
sudo apt install halpid
\`\`\`
See [apt.hatlabs.fi](https://github.com/hatlabs/apt.hatlabs.fi) for repository setup.
### Development
For development setup and build commands, see:
- [README.md](https://github.com/hatlabs/HALPI2-daemon/blob/main/README.md) - Installation and usage
- \`./run help\` - Available build and development commands
EOF
;;
stable)
cat > release_notes.md <<EOF
## HALPI2 Daemon v${VERSION}
Power monitor and watchdog service for HALPI2 - the Raspberry Pi CM5 based boat computer.
### Changes
${CHANGELOG}
### Features
- **Blackout Reporting**: Monitor input voltage and detect power loss
- **Automatic Shutdown**: Trigger safe system shutdown when power isn't restored
- **Supercap Voltage Monitoring**: Track backup power status
- **Watchdog Functionality**: Automatic hard reset if communication fails
- **RTC Sleep Mode**: Schedule wake times for battery-powered operations
- **USB Power Control**: Power-cycle USB ports for unresponsive devices
### Installation
This is the source code release. For Debian packages:
\`\`\`bash
sudo apt install halpid
\`\`\`
See [apt.hatlabs.fi](https://github.com/hatlabs/apt.hatlabs.fi) for repository setup.
### Development
For development setup and build commands, see:
- [README.md](https://github.com/hatlabs/HALPI2-daemon/blob/main/README.md) - Installation and usage
- \`./run help\` - Available build and development commands
EOF
;;
*)
echo "Error: Unknown RELEASE_TYPE '$RELEASE_TYPE'. Use 'prerelease', 'draft', or 'stable'"
exit 1
;;
esac
echo "Release notes created"