forked from ClemensElflein/OpenMowerOS
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
befb94b
commit 82e3be9
Showing
1 changed file
with
65 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ jobs: | |
shell: bash | ||
run: | | ||
sudo apt-get -qq update | ||
sudo apt-get install --yes coreutils p7zip-full qemu-user-static zip | ||
sudo apt-get install --yes aria2 coreutils p7zip-full qemu-user-static zip | ||
- name: Checkout CustomPiOS | ||
uses: actions/checkout@v3 | ||
|
@@ -43,42 +43,75 @@ jobs: | |
uses: actions/checkout@v3 | ||
with: | ||
repository: ${{ github.repository }} | ||
path: repository | ||
path: OpenMowerOS | ||
submodules: true | ||
|
||
- name: Download Raspberry Pi OS Source Image | ||
- name: Base Image Checksum | ||
id: checksum | ||
shell: bash | ||
run: aria2c -d repository/src/image/ --seed-time=0 https://downloads.raspberrypi.org/raspios_lite_arm64_latest.torrent | ||
run: | | ||
source OpenMowerOS/src/config | ||
DIST_VERSION=$(date +"%Y.%m.%d") | ||
cd OpenMowerOS/src/image | ||
FILENAME=$(basename ${DOWNLOAD_URL_CHECKSUM}) | ||
wget -O ${FILENAME} ${DOWNLOAD_URL_CHECKSUM} | ||
FILE_CONTENT=$(head -n 1 $FILENAME) | ||
CHECKSUM=$(echo $FILE_CONTENT | cut -d' ' -f1) | ||
echo "CHECKSUM=${CHECKSUM}" >> $GITHUB_OUTPUT | ||
echo "FILENAME=${FILENAME}" >> $GITHUB_OUTPUT | ||
echo "DOWNLOAD_URL_IMAGE=${DOWNLOAD_URL_IMAGE}" >> $GITHUB_OUTPUT | ||
- name: Cache Base Source Image | ||
id: cache | ||
#if: | ||
uses: actions/cache@v3 | ||
with: | ||
path: OpenMowerOS/src/image/*.img.xz | ||
key: base-image-${{ steps.checksum.outputs.CHECKSUM }} | ||
|
||
- name: Download Base Source Image via Torrent | ||
if: steps.cache.outputs.cache-hit != 'true' && endswith(steps.checksum.outputs.DOWNLOAD_URL_IMAGE, '.torrent') | ||
shell: bash | ||
run: aria2c -d OpenMowerOS/src/image --seed-time=0 ${{ steps.checksum.outputs.DOWNLOAD_URL_IMAGE }} | ||
|
||
- name: Download Base Source Image via wget | ||
if: steps.cache.outputs.cache-hit != 'true' && !endswith(steps.checksum.outputs.DOWNLOAD_URL_IMAGE, '.torrent') | ||
shell: bash | ||
run: | | ||
cd OpenMowerOS/src/image | ||
wget ${{ steps.checksum.outputs.DOWNLOAD_URL_IMAGE }} | ||
- name: Comparing Checksums | ||
shell: bash | ||
run: | | ||
cd repository/src/image | ||
curl -JL https://downloads.raspberrypi.org/raspios_lite_arm64_latest.sha256 | awk '{print $1" "$2}' | sha256sum -c | ||
cd OpenMowerOS/src/image | ||
sha256sum -b ${{ steps.checksum.outputs.FILENAME }} | ||
- name: Update CustomPiOS Paths | ||
shell: bash | ||
run: | | ||
cd repository/src | ||
cd OpenMowerOS/src | ||
../../CustomPiOS/src/update-custompios-paths | ||
- name: Build Image | ||
shell: bash | ||
run: | | ||
sudo modprobe loop | ||
cd repository/src | ||
cd OpenMowerOS/src | ||
sudo bash -x ./build_dist | ||
sudo chown -R $USER ./ | ||
- name: Copy output | ||
id: copy-image | ||
shell: bash | ||
run: | | ||
source repository/src/config | ||
NOW=$(date +"%Y-%m-%d-%Hh") | ||
IMAGE="${NOW}_${DIST_NAME}-${DIST_VERSION}" | ||
source OpenMowerOS/src/config | ||
NOW=$(date +"%Y_%m_%d-%H_%M") | ||
IMAGE="${NOW}-${DIST_NAME}-${DIST_VERSION}" | ||
cp repository/src/workspace/*.img $IMAGE.img | ||
cp OpenMowerOS/src/workspace/*.img $IMAGE.img | ||
echo "image=${IMAGE}" >> $GITHUB_OUTPUT | ||
|
@@ -87,7 +120,7 @@ jobs: | |
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build-failed-${{ steps.copy-image.outputs.image }}.log | ||
path: repository/src/build.log | ||
path: OpenMowerOS/src/build.log | ||
|
||
- name: Compress the image | ||
shell: bash | ||
|
@@ -118,4 +151,22 @@ jobs: | |
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ steps.copy-image.outputs.image }}.img.sha256 | ||
path: ${{ steps.copy-image.outputs.image }}.img.sha256 | ||
path: ${{ steps.copy-image.outputs.image }}.img.sha256 | ||
|
||
- name: Create latest Prerelease | ||
uses: "marvinpinto/[email protected]" | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
draft: false | ||
prerelease: true | ||
automatic_release_tag: latest | ||
title: Latest Development Builds | ||
files: | | ||
${{ steps.copy-image.outputs.image }}.img.xz | ||
${{ steps.copy-image.outputs.image }}.img.xz.sha256 | ||
${{ steps.copy-image.outputs.image }}.img.sha256 | ||
- name: Cleanup image artefacts | ||
shell: bash | ||
run: | | ||
rm ${{ steps.copy-image.outputs.image }}* |