forked from rusefi/fw-custom-example
-
Notifications
You must be signed in to change notification settings - Fork 3
175 lines (153 loc) · 5.86 KB
/
Copy pathnightly-release.yaml
File metadata and controls
175 lines (153 loc) · 5.86 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
name: Nightly Release
on:
schedule:
- cron: '0 2 * * *' # 2 AM UTC daily
workflow_dispatch:
inputs:
tag:
description: 'Release tag (default: today YYYY-MM-DD)'
required: false
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
tag: ${{ steps.set-tag.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
submodules: false
token: ${{ secrets.MY_REPO_PAT }}
- name: Checkout submodules
run: |
git config --global url."https://x-access-token:${{ secrets.MY_REPO_PAT }}@github.com/".insteadOf "git@github.com:"
git submodule update --init --force
- name: Set matrix
id: set-matrix
run: |
export EVENT_NAME="${{ github.event_name }}"
export RUN_ATTEMPT="${{ github.run_attempt }}"
export COMMIT_MESSAGE=""
echo "matrix=$(bash ext/rusefi/firmware/bin/generate_matrix.sh boards)" >> $GITHUB_OUTPUT
- name: Set release tag
id: set-tag
run: |
if [ -n "${{ github.event.inputs.tag }}" ]; then
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "tag=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
fi
build:
needs: generate-matrix
runs-on: ubuntu-latest
if: ${{ ! contains(needs.generate-matrix.outputs.matrix, '[]') }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
submodules: false
token: ${{ secrets.MY_REPO_PAT }}
- name: Checkout submodules
run: |
git config --global url."https://x-access-token:${{ secrets.MY_REPO_PAT }}@github.com/".insteadOf "git@github.com:"
git submodule update --init --force
- uses: ./ext/rusefi/.github/workflows/custom-board-build
with:
meta_info: ${{ matrix.meta-info }}
push: 'false'
run_simulator: 'false'
artifacts: bundle
uploads: ''
MY_REPO_PAT: ${{ secrets.MY_REPO_PAT }}
ADDITIONAL_ENV: ${{ secrets.ADDITIONAL_ENV }}
release:
needs: [generate-matrix, build]
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Download bundle artifacts
uses: actions/download-artifact@v4
with:
path: downloaded/
pattern: 'rusefi_bundle_*'
- name: Collect bundle ZIPs
run: |
mkdir -p bundles
for artifact_dir in downloaded/*/; do
artifact_name=$(basename "${artifact_dir%/}")
zip_name="${artifact_name%.zip}.zip"
(cd "$artifact_dir" && zip -r "../../bundles/${zip_name}" .)
echo "Packed: bundles/${zip_name}"
done
- name: List bundles
run: find bundles/ -type f | sort
- name: Read changelog
id: changelog
run: |
if [ -f CHANGELOG.md ]; then
BODY=$(awk '/^## \[/{p++} p==1{print} p==2{exit}' CHANGELOG.md | tail -n +2)
echo "body<<CHANGELOG_EOF" >> $GITHUB_OUTPUT
echo "$BODY" >> $GITHUB_OUTPUT
echo "CHANGELOG_EOF" >> $GITHUB_OUTPUT
else
echo "body=Automated nightly firmware build." >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.generate-matrix.outputs.tag }}
name: Nightly ${{ needs.generate-matrix.outputs.tag }}
prerelease: true
body: |
Automated nightly firmware build for Mazduino boards.
${{ steps.changelog.outputs.body }}
## Boards included
- mazduino-compact (STM32F407VGT6, knock enabled)
- mazduino-lite (STM32F407VGT6, no knock)
- mazduino-mini6ch (STM32F427VGT6, ETB + traction control)
- mazduino-mega100 (STM32F407VGT6, 1MB, full features, USB + CAN)
- mazduino-mega100-512 (STM32F407VET6, 512KB, reduced feature set)
## Bundle contents
Each `.zip` contains:
- `rusefi_console.jar` - rusEFI desktop application (requires Java 11+)
- `rusefi_<board>.ini` - TunerStudio definition file
- `rusefi.bin` - firmware binary (flash via ST-Link or DFU)
- Flash scripts (`flash_dfu.sh`, `flash_stlink.sh`)
## Flashing
- ST-Link / SWD: run `flash_stlink.sh` or use STM32CubeProgrammer with `rusefi.bin`
- USB DFU: hold BOOT0, then run `flash_dfu.sh`
## TunerStudio
Launch `rusefi_console.jar` or open TunerStudio and point it to the `.ini` file for your board.
files: bundles/*
- name: Extract INI files from bundles
id: extract-ini
run: |
mkdir -p ini-pages
while IFS= read -r ini; do
[ -f "$ini" ] || continue
SIG=$(grep -oP 'signature\s*=\s*"\K[^"]+' "$ini" | head -1)
SIGPART="${SIG#rusEFI }"
IFS='.' read -r BRANCH YEAR MONTH DAY TARGET HASH <<< "$SIGPART"
if [ -z "$HASH" ]; then
echo "Skipping $ini — could not parse signature: $SIG"
continue
fi
DEST="ini-pages/$BRANCH/$YEAR/$MONTH/$DAY/$TARGET"
mkdir -p "$DEST"
cp "$ini" "$DEST/${HASH}.ini"
echo "Staged: $DEST/${HASH}.ini"
done < <(find downloaded/ -name "*.ini" -type f)
ls -lR ini-pages/
- name: Deploy INI files to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.GHPAGES_DEPLOY_KEY }}
publish_dir: ./ini-pages
destination_dir: ini
keep_files: true