-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (147 loc) · 5.46 KB
/
Copy pathrelease.yml
File metadata and controls
178 lines (147 loc) · 5.46 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Version tag to release (e.g. v1.0.0) — must already exist"
required: true
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: write # needed to create GitHub Releases and upload assets
jobs:
# ─── Host unit tests ───────────────────────────────────────────────────────
test:
name: Host Unit Tests
runs-on: ubuntu-latest
container: mcr.microsoft.com/devcontainers/cpp:ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Configure CMake
run: |
cmake -B .vscode/build \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-Wno-dev
- name: Build tests
run: cmake --build .vscode/build --target pedal_tests -j$(nproc)
- name: Run tests
run: .vscode/build/test/pedal_tests --gtest_brief=1
# ─── Firmware build — ESP32 ────────────────────────────────────────────────
build-esp32:
name: Build ESP32 firmware
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install PlatformIO
run: pip install --quiet platformio
- name: Build ESP32 firmware
run: pio run -e nodemcu-32s
- name: Rename binary
run: |
TAG="${{ github.ref_name }}${{ github.event.inputs.tag }}"
cp .pio/build/nodemcu-32s/firmware.bin \
awesome-pedal-esp32-${TAG}.bin
- uses: actions/upload-artifact@v4
with:
name: firmware-esp32
path: awesome-pedal-esp32-*.bin
retention-days: 7
# ─── Firmware build — nRF52840 ─────────────────────────────────────────────
build-nrf52840:
name: Build nRF52840 firmware
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install PlatformIO
run: pip install --quiet platformio
- name: Build nRF52840 firmware
run: pio run -e feather-nrf52840
- name: Rename binary
run: |
TAG="${{ github.ref_name }}${{ github.event.inputs.tag }}"
cp .pio/build/feather-nrf52840/firmware.bin \
awesome-pedal-nrf52840-${TAG}.bin
- uses: actions/upload-artifact@v4
with:
name: firmware-nrf52840
path: awesome-pedal-nrf52840-*.bin
retention-days: 7
# ─── GitHub Release ────────────────────────────────────────────────────────
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build-esp32, build-nrf52840]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for changelog generation
- name: Resolve version tag
id: tag
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "value=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Generate changelog
id: changelog
run: |
TAG="${{ steps.tag.outputs.value }}"
PREV=$(git tag -l 'v*' | sort -V | grep -B1 "^${TAG}$" | head -1 || true)
if [[ -n "$PREV" && "$PREV" != "$TAG" ]]; then
RANGE="${PREV}..${TAG}"
else
RANGE="${TAG}"
fi
{
echo "body<<EOF"
echo "## What's Changed"
echo ""
git log "$RANGE" --pretty="- %s (%h)" --no-merges
echo ""
echo "**Full diff**: [\`${PREV}..${TAG}\`](../../compare/${PREV}...${TAG})"
echo "EOF"
} >> "$GITHUB_OUTPUT"
- name: Download ESP32 artifact
uses: actions/download-artifact@v4
with:
name: firmware-esp32
- name: Download nRF52840 artifact
uses: actions/download-artifact@v4
with:
name: firmware-nrf52840
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.value }}
name: "AwesomeStudioPedal ${{ steps.tag.outputs.value }}"
body: ${{ steps.changelog.outputs.body }}
files: |
awesome-pedal-esp32-*.bin
awesome-pedal-nrf52840-*.bin
draft: false
prerelease: false
- name: Archive closed tasks for this release
run: |
python scripts/organize_closed_tasks.py ${{ steps.tag.outputs.value }}
- name: Commit archived tasks if changed
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet HEAD; then
git add docs/developers/tasks/
git commit -m "chore: archive closed tasks for ${{ steps.tag.outputs.value }}"
git push
fi