forked from ublue-os/titanoboa
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
132 lines (123 loc) · 4.4 KB
/
Copy pathaction.yml
File metadata and controls
132 lines (123 loc) · 4.4 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: Titanoboa LiveCD ISO builder
description: >-
Create LiveCDs of a bootc container image.
The resulting iso will be placed at `output.iso`.
inputs:
image-ref:
description: Reference to the bootc container image.
required: true
livesys:
description: Install livesys helpers on the rootfs for the ISO
required: false
default: "true"
livesys-repo:
description: COPR repository for livesys-scripts (e.g., binarypie/hypercube for Hyprland support)
required: false
default: ""
compression:
description: Which type of compression will the ISO will use (erofs (default), or squashfs (smaller sizes, slower read))
required: false
default: squashfs
hook-post-rootfs:
description: >-
Path to a script ran in the rootfs of the container image before
being squashed in `squashfs.img`.
default: ""
hook-pre-initramfs:
description: >-
Path to a script to be ran before building the initramfs (per example, to swap the kernel).
default: ""
iso-dest:
description: Where the iso will be placed
required: false
default: ${{ github.workspace }}/output.iso
flatpaks-list:
description: Path to a file with a newline separated flatpak apps list to be installed in the rootfs.
required: false
default: none
container-image:
description: Container image that will be installed onto the target system (can be different from rootfs)
required: false
default: ""
add-polkit:
description: Add default polkit rules for the container
required: false
default: "true"
kargs:
description: Kernel arguments to be supplied for the live ISO, comma separated
required: false
default: ""
builder-distro:
description: Distribution to use for the builder container (for tools and dependencies)
required: false
default: fedora
outputs:
iso-dest:
description: Where the iso was be placed
value: ${{ steps.generate-iso.outputs.iso_dest }}
runs:
using: composite
steps:
- name: Install Just
id: install-just
uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
- name: Generate iso
id: generate-iso
env:
WORKSPACE: ${{ github.workspace }}
DESTINATION_PATH: ${{ inputs.iso-dest }}
COMPRESSION: ${{ inputs.compression }}
IMAGE_REF: ${{ inputs.image-ref }}
LIVESYS: ${{ inputs.livesys }}
LIVESYS_REPO: ${{ inputs.livesys-repo }}
ACTION_PATH: ${{ github.action_path }}
FLATPAKS_LIST: ${{ inputs.flatpaks-list }}
ADD_POLKIT: ${{ inputs.add-polkit }}
HOOK_POST_ROOTFS: ${{ inputs.hook-post-rootfs }}
HOOK_PRE_INITRAMFS: ${{ inputs.hook-pre-initramfs }}
CONTAINER_IMAGE: ${{ inputs.container-image }}
EXTRA_KARGS: ${{ inputs.kargs }}
TITANOBOA_BUILDER_DISTRO: ${{ inputs.builder-distro }}
shell: bash
run: |
set -euxo pipefail
cd "${ACTION_PATH}"
just=$(which just)
USE_LIVESYS=$(echo "${LIVESYS}" | sed -e 's/true/1/g' -e 's/false/0/g')
ADD_POLKIT=$(echo "${ADD_POLKIT}" | sed -e 's/true/1/g' -e 's/false/0/g')
sudo \
PATH="$PATH" \
CI="$CI" \
HOOK_post_rootfs="${HOOK_POST_ROOTFS}" \
HOOK_pre_initramfs="${HOOK_PRE_INITRAMFS}" \
TITANOBOA_BUILDER_DISTRO="${TITANOBOA_BUILDER_DISTRO}" \
$just build \
"${IMAGE_REF}" "${USE_LIVESYS}" "${FLATPAKS_LIST}" "${COMPRESSION}" "${EXTRA_KARGS}" "${CONTAINER_IMAGE}" "${ADD_POLKIT}" "${LIVESYS_REPO}"
# Fix iso file permisions
sudo chown $(id -u):$(id -g) ./output.iso
# Move iso to iso-dest
dest="$(realpath --relative-base="${WORKSPACE}" "${DESTINATION_PATH}")"
dest="$(realpath $dest)"
if [[ "$(realpath ./output.iso)" != "${dest}" ]]; then
mkdir -p "$(dirname "$dest")"
mv ./output.iso "$dest"
fi
echo "iso_dest=$dest" >> "$GITHUB_OUTPUT"
- name: Cleanup
id: titanoboa-cleanup
shell: bash
env:
ACTION_PATH: ${{ github.action_path }}
run: |
cd "${ACTION_PATH}"
# Cleanup
sudo PATH="$PATH" $(which just) clean
- name: Check the iso is there
shell: bash
env:
DEST_ISO: ${{ steps.generate-iso.outputs.iso_dest }}
run: |
[[ -f "${DEST_ISO}" ]] || {
echo "::error:Iso file does not exist at $dest"
exit 1
}