Repository navigation
131 lines (115 loc) · 3.58 KB
/
Copy pathgithubci.yml
File metadata and controls
131 lines (115 loc) · 3.58 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
name: Build
on:
workflow_dispatch:
pull_request:
push:
branches: [ master, main ]
release:
types:
- created
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
set-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout Code
uses: actions/checkout@v6
- name: Set matrix
id: set-matrix
working-directory: src/boards
run: |
MATRIX_JSON=$(ls -d */ | sed 's/\/$//' | jq -R -s -c 'split("\n")[:-1]')
echo "matrix=$MATRIX_JSON"
echo "matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
build:
needs: set-matrix
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
fail-fast: false
matrix:
board: ${{ fromJSON(needs.set-matrix.outputs.matrix) }}
steps:
- name: Checkout Code
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: true
- name: Install ARM GCC
uses: carlosperate/arm-none-eabi-gcc-action@v1.12.3
with:
release: '12.3.Rel1'
- name: Install Tools
run: |
pip3 install nrfutil intelhex setuptools
- name: Build with CMake
run: |
cmake -B _build_cmake -DBOARD=${{ matrix.board }} -DCMAKE_BUILD_TYPE=MinSizeRel
cmake --build _build_cmake
- name: Prepare artifacts
run: |
mkdir -p _bin/${{ matrix.board }}
cp _build_cmake/bootloader.hex _bin/${{ matrix.board }}/${{ matrix.board }}_bootloader.hex
cp _build_cmake/bootloader.elf _bin/${{ matrix.board }}/${{ matrix.board }}_bootloader.elf
- uses: actions/upload-artifact@v7
with:
name: ${{ matrix.board }}
path: _bin/${{ matrix.board }}
- name: Upload Release Asset
uses: softprops/action-gh-release@v3
if: ${{ github.event_name == 'release' }}
with:
files: |
_bin/${{ matrix.board }}/${{ matrix.board }}_bootloader.hex
commit-binaries:
needs: build
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout release tag
uses: actions/checkout@v6
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Download all bootloader artifacts
uses: actions/download-artifact@v8
with:
path: _artifacts
- name: Stage hex files into release/
run: |
set -euo pipefail
mkdir -p release
for board_dir in _artifacts/*/; do
board=$(basename "$board_dir")
hex="${board_dir}${board}_bootloader.hex"
if [ ! -f "$hex" ]; then
echo "::error::Missing $hex"
exit 1
fi
cp "$hex" "release/${board}_bootloader.hex"
git add "release/${board}_bootloader.hex"
done
rm -rf _artifacts
- name: Commit and move tag
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git diff --cached --quiet; then
echo "No bootloader hex changes to commit."
exit 0
fi
TAG="${{ github.event.release.tag_name }}"
git commit -m "Release ${TAG}: bootloader hex binaries"
git tag -f "${TAG}"
git push origin --force "refs/tags/${TAG}"