Skip to content

Commit ee9ce72

Browse files
authored
Add release job on push (#6)
1 parent f402326 commit ee9ce72

File tree

2 files changed

+83
-14
lines changed

2 files changed

+83
-14
lines changed

.github/workflows/build.yml

Lines changed: 78 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ name: Build NCS Firmware
33
on:
44
push:
55
branches: [ main ]
6+
tags:
7+
- '*'
68
pull_request:
79
branches: [ main ]
810

911
jobs:
1012
build:
1113
runs-on: ubuntu-latest
1214
container:
13-
image: ghcr.io/memfault/memfault-ncs-quickstart-fw:2025-11-04
15+
image: ghcr.io/memfault/memfault-ncs-quickstart-fw:2025-11-06
1416

1517
strategy:
1618
matrix:
@@ -25,6 +27,13 @@ jobs:
2527
fail-fast: false
2628

2729
steps:
30+
31+
- name: ccache
32+
uses: actions/cache@v3
33+
with:
34+
path: ~/.cache/ccache
35+
key: ccache-v1-${{ matrix.board }}-${{ runner.os }}
36+
2837
- name: Create sanitized board name
2938
id: board_name
3039
run: |
@@ -36,26 +45,82 @@ jobs:
3645
# Patch from here:
3746
# https://github.com/nrfconnect/sdk-nrf/compare/v3.2.0-preview2-branch...memfault:noahp/memfault-project-key-runtime-v3.2.0-preview2
3847
run: |
39-
wget -O - https://github.com/nrfconnect/sdk-nrf/compare/v3.2.0-preview2-branch...4c2c02efd79bd254b67d11730489195bf286914a.diff | git -C /opt/ncs/${MEMFAULT_NCS_VERSION}/nrf apply
48+
curl -fsSL https://github.com/nrfconnect/sdk-nrf/compare/v3.2.0-preview2-branch...e59bb1f4f85db5f9e4d66f6c66f90f4143f8ad5e.diff | git -C /opt/ncs/${MEMFAULT_NCS_VERSION}/nrf apply
4049
4150
- name: Build firmware for ${{ matrix.board }}
4251
run: |
4352
. /opt/toolchain-env.sh
4453
cd /opt/ncs/${MEMFAULT_NCS_VERSION}
45-
west build --build-dir 0.0.1 --sysbuild --pristine=always --board ${{ matrix.board }} nrf/samples/bluetooth/peripheral_mds -- -DCONFIG_MEMFAULT_NCS_PROJECT_KEY=\"dummy\" -DCONFIG_MEMFAULT_NCS_FW_VERSION=\"0.0.1\"
46-
west build --build-dir 0.0.2 --sysbuild --pristine=always --board ${{ matrix.board }} nrf/samples/bluetooth/peripheral_mds -- -DCONFIG_MEMFAULT_NCS_PROJECT_KEY=\"dummy\" -DCONFIG_MEMFAULT_NCS_FW_VERSION=\"0.0.2\"
54+
55+
# build 0.0.1 version
56+
west build --build-dir 0.0.1 --sysbuild --pristine=always --board ${{ matrix.board }} nrf/samples/bluetooth/peripheral_mds
57+
58+
# to build the 0.0.2 version, we need to modify the line like this in samples/bluetooth/peripheral_mds/VERSION:
59+
# PATCHLEVEL = 1
60+
# to
61+
# PATCHLEVEL = 2
62+
sed -i 's/PATCHLEVEL = 1/PATCHLEVEL = 2/' nrf/samples/bluetooth/peripheral_mds/VERSION
63+
west build --build-dir 0.0.2 --sysbuild --pristine=always --board ${{ matrix.board }} nrf/samples/bluetooth/peripheral_mds
64+
65+
- name: Store build artifact archives
66+
shell: bash
67+
run: |
68+
for ver in 0.0.1 0.0.2; do
69+
mkdir -p ~/artifacts/${{ steps.board_name.outputs.sanitized }}/${ver}/
70+
cd /opt/ncs/${MEMFAULT_NCS_VERSION}/${ver}/
71+
72+
# Copy common files for all boards
73+
cp \
74+
dfu_application.zip_manifest.json \
75+
dfu_application.zip \
76+
peripheral_mds/zephyr/zephyr.elf \
77+
\
78+
~/artifacts/${{ steps.board_name.outputs.sanitized }}/${ver}/
79+
80+
# Handle hex files - special case for nrf54h20dk board
81+
if [[ "${{ matrix.board }}" == "nrf54h20dk/nrf54h20/cpuapp" ]]; then
82+
# Copy the specific hex files for nrf54h20dk
83+
cp mcuboot/zephyr/zephyr.hex \
84+
~/artifacts/${{ steps.board_name.outputs.sanitized }}/${ver}/mcuboot.zephyr.hex
85+
cp ipc_radio/zephyr/zephyr.signed.hex \
86+
~/artifacts/${{ steps.board_name.outputs.sanitized }}/${ver}/ipc_radio.zephyr.signed.hex
87+
cp uicr/zephyr/zephyr.hex \
88+
~/artifacts/${{ steps.board_name.outputs.sanitized }}/${ver}/uicr.zephyr.hex
89+
cp peripheral_mds/zephyr/zephyr.signed.hex \
90+
~/artifacts/${{ steps.board_name.outputs.sanitized }}/${ver}/peripheral_mds.zephyr.signed.hex
91+
else
92+
# Copy merged.hex for all other boards
93+
cp merged.hex ~/artifacts/${{ steps.board_name.outputs.sanitized }}/${ver}/
94+
fi
95+
done
4796
4897
- name: Upload build artifacts
4998
uses: actions/upload-artifact@v4
5099
with:
51-
name: firmware-${{ steps.board_name.outputs.sanitized }}-${{ github.sha }}
100+
name: ${{ steps.board_name.outputs.sanitized }}
52101
path: |
53-
/opt/ncs/*/0.0.1/dfu_application.zip_manifest.json
54-
/opt/ncs/*/0.0.1/dfu_application.zip
55-
/opt/ncs/*/0.0.1/merged.hex
56-
/opt/ncs/*/0.0.1/peripheral_mds/zephyr/zephyr.elf
57-
/opt/ncs/*/0.0.2/dfu_application.zip_manifest.json
58-
/opt/ncs/*/0.0.2/dfu_application.zip
59-
/opt/ncs/*/0.0.2/merged.hex
60-
/opt/ncs/*/0.0.2/peripheral_mds/zephyr/zephyr.elf
102+
~/artifacts/${{ steps.board_name.outputs.sanitized }}
61103
retention-days: 30
104+
105+
release:
106+
needs: build
107+
runs-on: ubuntu-latest
108+
if: github.event_name == 'create' && github.event.ref_type == 'tag'
109+
110+
steps:
111+
- name: Checkout code
112+
uses: actions/checkout@v4
113+
114+
- name: Download all artifacts
115+
uses: actions/download-artifact@v6
116+
with:
117+
path: ./artifacts
118+
119+
- name: Create GitHub Release with auto-generated notes
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
run: |
123+
gh release create ${{ github.ref_name }} \
124+
--title "Release ${{ github.ref_name }}" \
125+
--generate-notes \
126+
./artifacts/*.zip

Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ ARG NCS_VERSION=v3.2.0-preview2
22

33
FROM ghcr.io/nrfconnect/sdk-nrf-toolchain:${NCS_VERSION}
44
ARG NCS_VERSION
5-
RUN rm /opt/ncs/toolchains/*/nrfutil/home/locked
5+
6+
RUN apt-get update && apt-get install -y \
7+
curl \
8+
zip \
9+
&& rm -rf /var/lib/apt/lists/*
610

711
# Manually install nRF-Connect SDK
812
RUN west init -m https://github.com/nrfconnect/sdk-nrf --mr ${NCS_VERSION} /opt/ncs/${NCS_VERSION} && \

0 commit comments

Comments
 (0)