Build Pi image #7
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
name: Build Pi image | |
on: | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
inputs: | |
deb-url: | |
description: 'URL for Kolibri deb file' | |
required: true | |
workflow_call: | |
inputs: | |
deb-file-name: | |
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: false | |
type: string | |
outputs: | |
zip-file-name: | |
description: "ZIP file name" | |
value: ${{ jobs.build_zip.outputs.zip-file-name }} | |
jobs: | |
build_zip: | |
name: Build Pi image | |
runs-on: ubuntu-latest | |
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 | |
if: ${{ inputs.ref }} | |
with: | |
repository: learningequality/kolibri-image-pi | |
ref: ${{ inputs.ref }} | |
- name: Download the debfile from URL and install | |
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 | |
with: | |
name: ${{ inputs.deb-file-name }} | |
path: dist | |
- name: Cache source image | |
uses: actions/cache@v4 | |
with: | |
path: 'images/source.img' | |
key: ${{ runner.OS }}-source-${{ hashFiles('Makefile') }} | |
restore-keys: | | |
${{ runner.OS }}-source- | |
- name: Cache base image | |
uses: actions/cache@v4 | |
with: | |
path: 'images/base.img' | |
key: ${{ runner.OS }}-base-${{ hashFiles('base.Pifile', 'files/*') }} | |
restore-keys: | | |
${{ runner.OS }}-base- | |
- name: Cache pimod | |
uses: actions/cache@v4 | |
with: | |
path: pimod | |
key: ${{ runner.OS }}-pimod-${{ hashFiles('Makefile') }} | |
restore-keys: | | |
${{ runner.OS }}-pimod- | |
- name: Build Pi image | |
run: make zipfile | |
- name: Get ZIP filename | |
id: get-zip-filename | |
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: dist/${{ steps.get-zip-filename.outputs.zip-file-name }} |