This repository has been archived by the owner on Jul 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (71 loc) · 2.72 KB
/
build.yaml
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
name: Build
on:
push:
branches-ignore:
- gh-pages
schedule:
- cron: "0 0 * * *"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
build:
runs-on: ubuntu-22.04
strategy:
matrix:
board:
- thingy91x/nrf9151/ns
- thingy91/nrf9160/ns
- nrf9160dk/nrf9160/ns
- nrf9161dk/nrf9161/ns
steps:
- run: |
BOARD="${{ matrix.board }}"
NAME=${BOARD//\//_} # Replace "/" with "_"
echo "NAME=${NAME}" >> $GITHUB_ENV
- name: Build AT host sample
run: |
docker run --rm \
-v ${PWD}:/workdir/project \
-w /workdir/nrf/samples/cellular/at_client \
nordicplayground/nrfconnect-sdk:main \
west build -p always -b ${{ matrix.board }} --build-dir /workdir/project/build
cp build/merged.hex at_host-${{ env.NAME }}.hex
# Ensure that the new build actually contains updated code,
# otherwise do not push a new release for this HEX file
- name: Calculate new checksum
id: new-checksum
run: |
sha512sum build/zephyr/zephyr.elf | cut -d " " -f 1 | tr -d '\n' > at_host-${{ env.NAME }}.elf.sha512sum
echo "checksum=`cat at_host-${{ env.NAME }}.elf.sha512sum`" >> $GITHUB_OUTPUT
- name: Get Current checksum
id: current-checksum
continue-on-error: true
run: |
CHECKSUM=$(curl -q --fail https://nordicsemiconductor.github.io/at_host-hex/at_host-${{ env.NAME }}.elf.sha512sum)
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@v4
if: steps.current-checksum.outcome == 'failure' || steps.new-checksum.outputs.checksum != steps.current-checksum.outputs.checksum
with:
if-no-files-found: error
name: at_host-${{ env.NAME }}-${{ github.sha }}
path: |
at_host-*.hex
at_host-*.elf.sha512sum
publish:
needs: [build]
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/saga'
steps:
- uses: actions/download-artifact@v4
- name: Publish HEX files
run: |
echo "machine github.com login accesskey password ${GITHUB_TOKEN}" > ~/.netrc
git config --global user.email "actions@example.com"
git config --global user.name "github-actions[bot]"
git clone https://github.com/${GITHUB_REPOSITORY}.git --branch gh-pages public
for folder in $(find ./ -type d -name 'at_host-*'); do cp ./${folder}/* public; done
cd public
git add -A
if git diff-index --quiet HEAD --; then echo "Nothing changed."; exit 0; fi
git commit -m "Update HEX files"
git push -f origin HEAD:gh-pages