99
1010jobs :
1111 deploy-release :
12+ strategy :
13+ max-parallel : 3
14+ matrix :
15+ device :
16+ - type : raspberrypi3
17+ fleet : info319/coderbot
1218 runs-on : ubuntu-latest
1319 environment : prod
1420 outputs :
@@ -19,13 +25,24 @@ jobs:
1925 id : build
2026 with :
2127 balena_token : ${{ secrets.BALENA_TOKEN }}
22- fleet : ${{ vars.BALENA_FLEET }}
28+ fleet : ${{ matrix.device.fleet }}
2329 registry_secrets : ${{ secrets.GHCR_CREDS }}
2430 source : .
2531 - name : Log release ID built
2632 run : echo "Built release version ${{ steps.build.outputs.release_id }}"
2733
2834 build-balena :
35+ strategy :
36+ matrix :
37+ device :
38+ - type : raspberrypi3
39+ version : v5.3.7.dev
40+ fleet : info319/coderbot
41+ env :
42+ IMAGE_NAME : coderbot_${{ matrix.device.type }}.img
43+ DEVICE_TYPE : ${{ matrix.device.type }}
44+ DEVICE_VERSION : ${{ matrix.device.version }}
45+ BALENA_FLEET : ${{ matrix.device.fleet }}
2946 needs : deploy-release
3047 runs-on : ubuntu-latest
3148 environment : prod
@@ -36,20 +53,21 @@ jobs:
3653 - run : export PATH=$PATH:$(pwd)/balena-cli
3754 - run : ./balena-cli/balena --version
3855 - run : ./balena-cli/balena login --token ${{ secrets.BALENA_TOKEN }}
39- - run : ./balena-cli/balena os download raspberrypi3 --version v5.1.20+rev1.dev --output raspberrypi3.img
56+ - run : ./balena-cli/balena os download $DEVICE_TYPE --version $DEVICE_VERSION --output $IMAGE_NAME
4057 - run : sudo mkdir /mnt/resin-boot
41- - run : sudo mount -o loop,offset=$(( 512 * 8192)) raspberrypi3.img /mnt/resin-boot
58+ - run : sudo mount -o loop,offset=$(( 512 * 8192)) $IMAGE_NAME /mnt/resin-boot
4259 - run : sudo cp rpi/config.txt /mnt/resin-boot
4360 - run : sudo umount /mnt/resin-boot
44- - run : ./balena-cli/balena config generate --version 5.1.20+rev1.dev --deviceType raspberrypi3 --fleet ${{ vars. BALENA_FLEET }} --network ethernet --appUpdatePollInterval 10 --dev -o config.json
45- - run : ./balena-cli/balena os configure raspberrypi3.img --fleet ${{ vars. BALENA_FLEET }} --config config.json --config-network ethernet
46- - run : sudo ./balena-cli/balena config write --drive raspberrypi3.img hostname coderbot
61+ - run : ./balena-cli/balena config generate --version $DEVICE_VERSION --deviceType $DEVICE_TYPE --fleet $BALENA_FLEET --network ethernet --appUpdatePollInterval 10 --dev -o config.json
62+ - run : ./balena-cli/balena os configure $IMAGE_NAME --fleet $BALENA_FLEET --config config.json --config-network ethernet
63+ - run : sudo ./balena-cli/balena config write --drive $IMAGE_NAME hostname coderbot
4764 - run : echo "RELEASE_COMMIT=current" >> $GITHUB_ENV # echo "RELEASE_COMMIT=$(./balena-cli/balena release ${{ needs.deploy-release.outputs.release_id }}|grep 'COMMIT'|awk '{print $2}')" >> $GITHUB_ENV
48- - run : ./balena-cli/balena preload raspberrypi3.img --fleet ${{ vars. BALENA_FLEET }} -c $RELEASE_COMMIT
65+ - run : ./balena-cli/balena preload $IMAGE_NAME --fleet $BALENA_FLEET -c $RELEASE_COMMIT
4966 - run : mkdir -p dist
50- - run : mv raspberrypi3.img ./dist/.
67+ - run : mv $IMAGE_NAME ./dist/.
5168 - name : Archive dist
5269 uses : actions/upload-artifact@v3
5370 with :
5471 name : image-preloaded
5572 path : dist
73+
0 commit comments