From 2724a337bd7ed1a3544c1c7c3219d9deca5c3cfc Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 14 Nov 2024 12:54:49 -0800 Subject: [PATCH 1/3] Bring build action up to date --- .github/workflows/build_img.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_img.yml b/.github/workflows/build_img.yml index b618263..40a1fa4 100644 --- a/.github/workflows/build_img.yml +++ b/.github/workflows/build_img.yml @@ -10,11 +10,15 @@ on: workflow_call: inputs: deb-file-name: - required: true + required: false + type: string + deb-url: + description: 'URL for Kolibri deb file' + required: false type: string ref: description: 'A ref for this workflow to check out its own repo' - required: true + required: false type: string outputs: zip-file-name: @@ -28,6 +32,11 @@ jobs: outputs: zip-file-name: ${{ steps.get-zip-filename.outputs.zip-file-name }} steps: + - name: Validate deb reference inputs + if: ${{ (inputs.deb-file-name && inputs.deb-url) || (!inputs.deb-file-name && !inputs.deb-url) }} + run: | + echo "Must specify only one reference for the deb file to build the image with." + exit 1 - uses: actions/checkout@v4 if: ${{ !inputs.ref }} - uses: actions/checkout@v4 @@ -36,8 +45,8 @@ jobs: repository: learningequality/kolibri-image-pi ref: ${{ inputs.ref }} - name: Download the debfile from URL and install - if: ${{ github.event.inputs.deb-url }} - run: make get-deb deb=${{ github.event.inputs.deb-url }} + if: ${{ inputs.deb-url }} + run: make get-deb deb=${{ inputs.deb-url }} - name: Download the debfile from artifacts if: ${{ inputs.deb-file-name }} uses: actions/download-artifact@v4 From 312cba6743fd8fff37fb36b249b609a0d3023f16 Mon Sep 17 00:00:00 2001 From: Richard Tibbles Date: Thu, 14 Nov 2024 18:31:57 -0800 Subject: [PATCH 2/3] Update build to version img and zipfiles. --- .github/workflows/build_img.yml | 8 +++----- Makefile | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_img.yml b/.github/workflows/build_img.yml index 40a1fa4..7a66145 100644 --- a/.github/workflows/build_img.yml +++ b/.github/workflows/build_img.yml @@ -75,13 +75,11 @@ jobs: restore-keys: | ${{ runner.OS }}-pimod- - name: Build Pi image - run: | - make images - zip Kolibri.zip images/Kolibri.img + run: make zipfile - name: Get ZIP filename id: get-zip-filename - run: echo "zip-file-name=Kolibri.zip" >> $GITHUB_OUTPUT + run: echo "zip-file-name=$(ls dist | grep .zip | cat)" >> $GITHUB_OUTPUT - uses: actions/upload-artifact@v4 with: name: ${{ steps.get-zip-filename.outputs.zip-file-name }} - path: ${{ steps.get-zip-filename.outputs.zip-file-name }} + path: dist/${{ steps.get-zip-filename.outputs.zip-file-name }} diff --git a/Makefile b/Makefile index 65bd8d8..7ab4aaa 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ .PHONY: get-deb clean-deb clean-images clean-tools clean install-dependencies +DIST_DIR := dist + SOURCE_FILE = images/source.xz SOURCE_URL = https://downloads.raspberrypi.com/raspios_lite_arm64/images/raspios_lite_arm64-2024-10-28/2024-10-22-raspios-bookworm-arm64-lite.img.xz @@ -13,13 +15,13 @@ clean-tools: rm -rf pimod clean-deb: - rm -rf dist - mkdir dist + rm -rf $(DIST_DIR) + mkdir $(DIST_DIR) get-deb: clean-deb # The eval and shell commands here are evaluated when the recipe is parsed, so we put the cleanup # into a prerequisite make step, in order to ensure they happen prior to the download. - $(eval DLFILE = $(shell wget --content-disposition -P dist/ "${deb}" 2>&1 | grep "Saving to: " | sed 's/Saving to: ‘//' | sed 's/’//')) + $(eval DLFILE = $(shell wget --content-disposition -P $(DIST_DIR)/ "${deb}" 2>&1 | grep "Saving to: " | sed 's/Saving to: ‘//' | sed 's/’//')) $(eval DEBFILE = $(shell echo "${DLFILE}" | sed "s/\?.*//")) [ "${DLFILE}" = "${DEBFILE}" ] || mv "${DLFILE}" "${DEBFILE}" @@ -54,3 +56,13 @@ images: install-dependencies $(MAKE) images/source.img $(MAKE) images/base.img $(MAKE) images/Kolibri.img + +zipfile: images +# Get the version based on the debian file name kolibri_-Xubuntu1_all.deb + $(eval VERSION=$(shell ls ${DIST_DIR} | grep kolibri | sed -r 's/kolibri_(.*)-[0-9]+ubuntu1_all.deb/\1/')) +# Rename the image file to include the version + mv images/Kolibri.img images/kolibri-pi-image-$(VERSION).img +# Zip the image file + zip -j $(DIST_DIR)/kolibri-pi-image-$(VERSION).zip images/kolibri-pi-image-$(VERSION).img +# Clean up the final image file + rm images/kolibri-pi-image-$(VERSION).img From de03b7bd5aeda2bb85ecf8bec44878a40916a77f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20L=2E=20Redrejo=20Rodr=C3=ADguez?= Date: Tue, 19 Nov 2024 21:09:03 +0100 Subject: [PATCH 3/3] fixed typo --- .github/workflows/build_img.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_img.yml b/.github/workflows/build_img.yml index 7a66145..025b125 100644 --- a/.github/workflows/build_img.yml +++ b/.github/workflows/build_img.yml @@ -64,7 +64,7 @@ jobs: uses: actions/cache@v4 with: path: 'images/base.img' - key: ${{ runner.OS }}-base-${{ hashFiles('base.Pifle', 'files/*') }} + key: ${{ runner.OS }}-base-${{ hashFiles('base.Pifile', 'files/*') }} restore-keys: | ${{ runner.OS }}-base- - name: Cache pimod