3131 shell : bash
3232 run : |
3333 sudo apt-get -qq update
34- sudo apt-get install --yes coreutils p7zip-full qemu-user-static zip
34+ sudo apt-get install --yes aria2 coreutils p7zip-full qemu-user-static zip
3535
3636 - name : Checkout CustomPiOS
3737 uses : actions/checkout@v3
@@ -43,42 +43,75 @@ jobs:
4343 uses : actions/checkout@v3
4444 with :
4545 repository : ${{ github.repository }}
46- path : repository
46+ path : OpenMowerOS
4747 submodules : true
4848
49- - name : Download Raspberry Pi OS Source Image
49+ - name : Base Image Checksum
50+ id : checksum
5051 shell : bash
51- run : aria2c -d repository/src/image/ --seed-time=0 https://downloads.raspberrypi.org/raspios_lite_arm64_latest.torrent
52+ run : |
53+ source OpenMowerOS/src/config
54+ DIST_VERSION=$(date +"%Y.%m.%d")
55+ cd OpenMowerOS/src/image
56+ FILENAME=$(basename ${DOWNLOAD_URL_CHECKSUM})
57+ wget -O ${FILENAME} ${DOWNLOAD_URL_CHECKSUM}
58+ FILE_CONTENT=$(head -n 1 $FILENAME)
59+ CHECKSUM=$(echo $FILE_CONTENT | cut -d' ' -f1)
60+
61+ echo "CHECKSUM=${CHECKSUM}" >> $GITHUB_OUTPUT
62+ echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT
63+
64+ echo "DOWNLOAD_URL_IMAGE=${DOWNLOAD_URL_IMAGE}" >> $GITHUB_OUTPUT
65+
66+ - name : Cache Base Source Image
67+ id : cache
68+ # if:
69+ uses : actions/cache@v3
70+ with :
71+ path : OpenMowerOS/src/image/*.img.xz
72+ key : base-image-${{ steps.checksum.outputs.CHECKSUM }}
73+
74+ - name : Download Base Source Image via Torrent
75+ if : steps.cache.outputs.cache-hit != 'true' && endswith(steps.checksum.outputs.DOWNLOAD_URL_IMAGE, '.torrent')
76+ shell : bash
77+ run : aria2c -d OpenMowerOS/src/image --seed-time=0 ${{ steps.checksum.outputs.DOWNLOAD_URL_IMAGE }}
78+
79+ - name : Download Base Source Image via wget
80+ if : steps.cache.outputs.cache-hit != 'true' && !endswith(steps.checksum.outputs.DOWNLOAD_URL_IMAGE, '.torrent')
81+ shell : bash
82+ run : |
83+ cd OpenMowerOS/src/image
84+ wget ${{ steps.checksum.outputs.DOWNLOAD_URL_IMAGE }}
5285
5386 - name : Comparing Checksums
5487 shell : bash
5588 run : |
56- cd repository /src/image
57- curl -JL https://downloads.raspberrypi.org/raspios_lite_arm64_latest.sha256 | awk '{print $1" "$2}' | sha256sum -c
89+ cd OpenMowerOS /src/image
90+ sha256sum -b ${{ steps.checksum.outputs.FILENAME }}
5891
5992 - name : Update CustomPiOS Paths
6093 shell : bash
6194 run : |
62- cd repository /src
95+ cd OpenMowerOS /src
6396 ../../CustomPiOS/src/update-custompios-paths
6497
6598 - name : Build Image
6699 shell : bash
67100 run : |
68101 sudo modprobe loop
69- cd repository /src
102+ cd OpenMowerOS /src
70103 sudo bash -x ./build_dist
71104 sudo chown -R $USER ./
72105
73106 - name : Copy output
74107 id : copy-image
75108 shell : bash
76109 run : |
77- source repository /src/config
78- NOW=$(date +"%Y-%m- %d-%Hh ")
79- IMAGE="${NOW}_ ${DIST_NAME}-${DIST_VERSION}"
110+ source OpenMowerOS /src/config
111+ NOW=$(date +"%Y_%m_ %d-%H_%M ")
112+ IMAGE="${NOW}- ${DIST_NAME}-${DIST_VERSION}"
80113
81- cp repository /src/workspace/*.img $IMAGE.img
114+ cp OpenMowerOS /src/workspace/*.img $IMAGE.img
82115
83116 echo "image=${IMAGE}" >> $GITHUB_OUTPUT
84117
87120 uses : actions/upload-artifact@v3
88121 with :
89122 name : build-failed-${{ steps.copy-image.outputs.image }}.log
90- path : repository /src/build.log
123+ path : OpenMowerOS /src/build.log
91124
92125 - name : Compress the image
93126 shell : bash
@@ -118,4 +151,22 @@ jobs:
118151 uses : actions/upload-artifact@v3
119152 with :
120153 name : ${{ steps.copy-image.outputs.image }}.img.sha256
121- path : ${{ steps.copy-image.outputs.image }}.img.sha256
154+ path : ${{ steps.copy-image.outputs.image }}.img.sha256
155+
156+ - name : Create latest Prerelease
157+ uses :
" marvinpinto/[email protected] " 158+ with :
159+ repo_token : " ${{ secrets.GITHUB_TOKEN }}"
160+ draft : false
161+ prerelease : true
162+ automatic_release_tag : latest
163+ title : Latest Development Builds
164+ files : |
165+ ${{ steps.copy-image.outputs.image }}.img.xz
166+ ${{ steps.copy-image.outputs.image }}.img.xz.sha256
167+ ${{ steps.copy-image.outputs.image }}.img.sha256
168+
169+ - name : Cleanup image artefacts
170+ shell : bash
171+ run : |
172+ rm ${{ steps.copy-image.outputs.image }}*
0 commit comments