forked from wled/WLED
-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (200 loc) · 8.29 KB
/
release.yml
File metadata and controls
242 lines (200 loc) · 8.29 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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
name: Release Build
on:
push:
tags:
- 'v*' # Triggers on version tags like v0.16.0 or v0.16.0-beta
jobs:
determine-release-type:
runs-on: ubuntu-latest
outputs:
is_beta: ${{ steps.check.outputs.is_beta }}
version: ${{ steps.check.outputs.version }}
steps:
- name: Check release type
id: check
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ "$TAG" == *"-beta"* ]] || [[ "$TAG" == *"-rc"* ]]; then
echo "is_beta=true" >> $GITHUB_OUTPUT
echo "This is a staging/beta release"
else
echo "is_beta=false" >> $GITHUB_OUTPUT
echo "This is a production release"
fi
# Remove 'v' prefix for version
VERSION="${TAG#v}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
build-firmware:
needs: determine-release-type
runs-on: ubuntu-latest
timeout-minutes: 45 # Allow enough time for full build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
~/.platformio
~/.buildcache
key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini') }}
restore-keys: |
${{ runner.os }}-pio-
- name: Install Node.js dependencies
run: npm ci
- name: Install PlatformIO
run: pip install -r requirements.txt
- name: Build Web UI
run: npm run build
timeout-minutes: 2
- name: Run Tests
run: npm test
timeout-minutes: 3
- name: Build Firmware
run: pio run -e icon256
timeout-minutes: 30
- name: Prepare release artifacts
run: |
mkdir -p release-artifacts
cp build_output/release/*.bin release-artifacts/ || true
ls -la release-artifacts/
- name: Generate version-beta.json for staging (on beta branch)
if: needs.determine-release-type.outputs.is_beta == 'true'
run: |
cat > release-artifacts/version-beta.json << EOF
{
"version": "${{ needs.determine-release-type.outputs.version }}",
"url": "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/WLED_${{ needs.determine-release-type.outputs.version }}_ESP32_S3_Icon256.bin",
"release_notes": "https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}",
"published_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"is_beta": true
}
EOF
cat release-artifacts/version-beta.json
- name: Generate version.json for production (on main branch)
if: needs.determine-release-type.outputs.is_beta == 'false'
run: |
cat > release-artifacts/version.json << EOF
{
"version": "${{ needs.determine-release-type.outputs.version }}",
"url": "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/WLED_${{ needs.determine-release-type.outputs.version }}_ESP32_S3_Icon256.bin",
"release_notes": "https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}",
"published_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
"is_beta": false
}
EOF
cat release-artifacts/version.json
- name: Rename firmware with version
run: |
cd release-artifacts
for file in *.bin; do
if [ -f "$file" ]; then
newname=$(echo "$file" | sed "s/WLED_0\.16\.0-alpha/WLED_${{ needs.determine-release-type.outputs.version }}/g")
mv "$file" "$newname"
echo "Renamed $file to $newname"
fi
done
ls -la
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: firmware-release-${{ needs.determine-release-type.outputs.version }}
path: release-artifacts/*
create-release:
needs: [determine-release-type, build-firmware]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: firmware-release-${{ needs.determine-release-type.outputs.version }}
path: release-artifacts
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: release-artifacts/*
draft: false
prerelease: ${{ needs.determine-release-type.outputs.is_beta == 'true' }}
body: |
## WLED Icon256 Release ${{ needs.determine-release-type.outputs.version }}
${{ needs.determine-release-type.outputs.is_beta == 'true' && '⚠️ **BETA RELEASE** - For Friends & Family Testing Only' || '✅ **PRODUCTION RELEASE**' }}
### Installation
1. Download `WLED_${{ needs.determine-release-type.outputs.version }}_ESP32_S3_Icon256.bin`
2. Flash to your Icon256 device using [ESP Flash Tool](https://github.com/Aircoookie/WLED/wiki/Install-WLED-binary) or OTA
### What's Included
- 🎨 Icon256 Word Clock usermod
- 🎵 Audio Reactive effects
- 🔄 Remote OTA Update support
### Remote OTA Configuration
${{ needs.determine-release-type.outputs.is_beta == 'true' && 'Beta testers should configure: `https://raw.githubusercontent.com/' || 'Configure: `https://raw.githubusercontent.com/' }}${{ github.repository }}/beta/${{ needs.determine-release-type.outputs.is_beta == 'true' && 'version-beta.json' || 'version.json' }}`
---
**Full Changelog**: https://github.com/${{ github.repository }}/compare/....${{ github.ref_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-beta-branch:
needs: [determine-release-type, create-release]
if: needs.determine-release-type.outputs.is_beta == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: firmware-release-${{ needs.determine-release-type.outputs.version }}
path: release-artifacts
- name: Update beta branch with version file
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
# Create or switch to beta branch
git checkout -B beta
# Copy version file to root
cp release-artifacts/version-beta.json version-beta.json
# Commit and push
git add version-beta.json
git commit -m "Update beta version to ${{ needs.determine-release-type.outputs.version }}"
git push -f origin beta
update-main-branch:
needs: [determine-release-type, create-release]
if: needs.determine-release-type.outputs.is_beta == 'false'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: firmware-release-${{ needs.determine-release-type.outputs.version }}
path: release-artifacts
- name: Update main branch with version file
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
# Ensure we're on main
git checkout main
# Copy version file to root
cp release-artifacts/version.json version.json
# Commit and push
git add version.json
git commit -m "Update production version to ${{ needs.determine-release-type.outputs.version }}"
git push origin main