-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (138 loc) · 5.31 KB
/
release.yml
File metadata and controls
160 lines (138 loc) · 5.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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: Release
on:
push:
tags:
- 'v*'
jobs:
validate-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for changelog generation
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Install PlatformIO
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Validate PlatformIO examples build successfully
run: |
set -e
examples=(SimpleGet PostWithData MultipleRequests CustomHeaders StreamingUpload CompileTest)
for name in "${examples[@]}"; do
echo "Building PlatformIO example: $name"
dir="examples/platformio/${name}"
test -f "$dir/platformio.ini" || (echo "Missing platformio.ini in $dir" && exit 1)
test -f "$dir/src/main.cpp" || (echo "Missing src/main.cpp in $dir" && exit 1)
(cd "$dir" && pio run -e esp32dev)
done
- name: Verify Arduino sketches exist
run: |
set -e
examples=(SimpleGet PostWithData MultipleRequests CustomHeaders StreamingUpload CompileTest)
for name in "${examples[@]}"; do
sketch="examples/arduino/${name}/${name}.ino"
test -f "$sketch" || (echo "Missing Arduino sketch: $sketch" && exit 1)
done
- name: Verify release metadata & consistency
run: |
bash scripts/verify-release.sh
- name: Create source archive
run: |
VERSION=$(jq -r '.version' library.json)
ARCHIVE="ESPAsyncWebClient-${VERSION}.zip"
zip -r "$ARCHIVE" src examples README.md LICENSE library.json library.properties
echo "Created $ARCHIVE"
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: source-archive
path: ${{ env.ARCHIVE }}
- name: Extract changelog for this version
id: changelog
run: |
VERSION=$(jq -r '.version' library.json)
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
# Extract the section for this version from CHANGELOG.md
# Matches everything between "## [X.Y.Z]" and the next "## [" heading
NOTES=""
if [[ -f CHANGELOG.md ]]; then
NOTES=$(awk -v ver="${VERSION}" '
BEGIN { found=0 }
/^## \[/ {
if (found) exit
if ($0 ~ "\\[" ver "\\]") { found=1; next }
}
found { print }
' CHANGELOG.md)
fi
if [[ -z "${NOTES}" ]]; then
echo "No CHANGELOG entry found for ${VERSION}, generating from commits..."
# Get the previous tag
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
if [[ -n "${PREV_TAG}" ]]; then
NOTES=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges)
else
NOTES=$(git log --pretty=format:"- %s (%h)" --no-merges -20)
fi
fi
# Write to file to preserve multiline
echo "${NOTES}" > /tmp/release_notes.md
- name: Generate AI-style release summary
id: summary
run: |
VERSION="${{ steps.changelog.outputs.version }}"
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
# Build a structured release body
{
echo "# ESPAsyncWebClient v${VERSION}"
echo ""
# Changelog section
echo "## What's Changed"
cat /tmp/release_notes.md
echo ""
# Auto-generated commit summary by category
if [[ -n "${PREV_TAG}" ]]; then
echo "## Commit Summary"
echo ""
# Fixes
FIXES=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges --grep="^[Ff]ix" || true)
if [[ -n "${FIXES}" ]]; then
echo "### Bug Fixes"
echo "${FIXES}"
echo ""
fi
# Features
FEATURES=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges --grep="^[Ff]eat" || true)
if [[ -n "${FEATURES}" ]]; then
echo "### New Features"
echo "${FEATURES}"
echo ""
fi
# Other commits
OTHER=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s (%h)" --no-merges --invert-grep --grep="^[Ff]ix" --grep="^[Ff]eat" || true)
if [[ -n "${OTHER}" ]]; then
echo "### Other Changes"
echo "${OTHER}"
echo ""
fi
echo "**Full diff**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...v${VERSION}"
echo ""
fi
# Stats
echo "## Verification"
echo "- :white_check_mark: All examples built successfully"
echo "- :white_check_mark: Version metadata consistent across library.json, library.properties, and HttpCommon.h"
echo "- :package: Source archive attached"
} > /tmp/full_release_notes.md
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ARCHIVE }}
name: "v${{ steps.changelog.outputs.version }}"
body_path: /tmp/full_release_notes.md
generate_release_notes: true