1+ name : Build and Deploy for Raspberry Pi
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ tags :
8+ - ' v*'
9+
10+ jobs :
11+ build-and-deploy :
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout repository
16+ uses : actions/checkout@v4
17+ with :
18+ submodules : false
19+
20+ - name : Set up QEMU
21+ uses : docker/setup-qemu-action@v2
22+ with :
23+ platforms : linux/arm64
24+
25+ - name : Set up Docker Buildx
26+ uses : docker/setup-buildx-action@v3
27+
28+ - name : Build Docker image for ARM64
29+ run : |
30+ docker buildx build \
31+ -f ./RaspberryPi/deploy/dockerfiles/DockerfileDeployRasp \
32+ --platform linux/arm64 --load \
33+ --build-arg projectDir=$PWD/$PROJECT_DIR \
34+ -t final-app .
35+ - name : Extract built binaries
36+ run : |
37+ mkdir -p artifacts/bin
38+ mkdir -p artifacts/config
39+ mkdir -p artifacts/fonts
40+ docker create --name tmpapp final-app
41+ docker cp tmpapp:/home/$PROJECT_DIR/InstrumentClusterApp ./artifacts/bin/
42+ docker cp tmpapp:/home/$PROJECT_DIR/MiddleWareApp ./artifacts/bin/
43+ cp ./$PROJECT_DIR/ZenohConfig/InstrumentClusterConfig.json ./artifacts/config/
44+ cp ./$PROJECT_DIR/ZenohConfig/MiddleWareConfig.json ./artifacts/config/
45+ cp -r ./RaspberryPi/deploy/fonts/* ./artifacts/fonts/
46+ git archive --format=zip HEAD -o ./artifacts/source-code.zip
47+ cd artifacts
48+ zip -r ../release-package.zip *
49+ cd ..
50+ docker rm tmpapp
51+ - name : Get latest tag and increment
52+ id : tag
53+ run : |
54+ git fetch --tags --force
55+ git fetch origin
56+ latest_tag=$(git tag --sort=-v:refname | head -n 1)
57+ if [ -z "$latest_tag" ]; then
58+ latest_tag="v1.0.0"
59+ fi
60+ major=$(echo $latest_tag | cut -d. -f1 | tr -d 'v')
61+ minor=$(echo $latest_tag | cut -d. -f2)
62+ patch=$(echo $latest_tag | cut -d. -f3)
63+ new_tag="v$major.$minor.$((patch + 1))"
64+ echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
65+ - name : Create GitHub Release
66+ uses : softprops/action-gh-release@v1
67+ with :
68+ tag_name : ${{ steps.tag.outputs.new_tag }}
69+ name : Release ${{ steps.tag.outputs.new_tag }}
70+ body : |
71+ ## Raspberry Pi Release
72+ **Includes:**
73+ - Compiled apps (`InstrumentClusterApp`, `MiddleWareApp`)
74+ - Zenoh config files
75+ - Fonts
76+ - Full source code zip
77+ **Instructions:**
78+ - Copy `InstrumentClusterApp` and `MiddleWareApp` to `$PI_PATH_BIN`
79+ - Copy configs to `$PI_PATH_ETC`
80+ - Copy fonts to `$PI_PATH_FONTS`
81+ files : |
82+ release-package.zip
83+ artifacts/source-code.zip
84+ artifacts/bin/*
85+ env :
86+ GITHUB_TOKEN : ${{ secrets.PAT_LUIS }}
0 commit comments