Repository navigation
69 lines (62 loc) · 2.24 KB
/
Copy pathbuild-image.yml
File metadata and controls
69 lines (62 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: build-dpea-pi-image
on:
workflow_dispatch:
push:
branches: [main]
paths:
- packages.txt
- customize.sh
- files/**
- build-image.sh
- .github/workflows/**
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v4
- name: Free disk + install tools
run: |
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc /usr/local/.ghcup
df -h
sudo apt-get update
sudo apt-get install -y xz-utils parted e2fsprogs curl
- name: Build image
run: sudo -E ./build-image.sh
- name: Generate Imager OS list
run: |
set -euo pipefail
sudo chown -R "$(id -u):$(id -g)" .build # build-image.sh ran as root
. .build/image-meta.env
TAG="dpea-pi-$(date +%Y%m%d-%H%M)"
IMG_URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG}/${IMG_FILE}"
# init_format enables Imager's Customisation panel.
jq -n \
--arg url "$IMG_URL" \
--arg date "$(date +%Y-%m-%d)" \
--arg sha "$EXTRACT_SHA256" \
--argjson esize "$EXTRACT_SIZE" \
--argjson dsize "$IMAGE_DOWNLOAD_SIZE" \
'{os_list: [ {
name: "DPEA Pi",
description: "DPEA exhibit base image (Raspberry Pi OS Trixie 64-bit + DPEA config)",
url: $url,
release_date: $date,
init_format: "systemd",
extract_size: $esize,
extract_sha256: $sha,
image_download_size: $dsize
} ] }' > .build/os-list.json
jq . .build/os-list.json > /dev/null && echo "os-list.json is valid JSON"
echo "TAG=$TAG" >> "$GITHUB_ENV"
echo "IMG_FILE=$IMG_FILE" >> "$GITHUB_ENV"
- name: Publish latest Release
if: github.event_name != 'pull_request'
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh release create "$TAG" ".build/${IMG_FILE}" .build/os-list.json \
--repo "$GITHUB_REPOSITORY" --title "$TAG" \
--notes "Auto-built DPEA Pi image from ${GITHUB_SHA::7}" --latest