Skip to content

Commit 9ac7a99

Browse files
committed
feat: initial version of RCL example
1 parent 8c26c6e commit 9ac7a99

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed

.github/workflows/100-build-rcl.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: bluebuild
2+
on:
3+
push:
4+
paths-ignore: # don't rebuild if only documentation has changed
5+
- "**.md"
6+
7+
pull_request:
8+
workflow_dispatch: # allow manually triggering builds
9+
jobs:
10+
rcl:
11+
name: Build recipe files with rcl
12+
runs-on: ubuntu-latest
13+
outputs:
14+
recipe-matrix: ${{ steps.rcl.outputs.recipe-matrix }}
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Install rcl
20+
run: |
21+
git clone https://github.com/ruuda/rcl.git /tmp/rcl
22+
cd /tmp/rcl && cargo build --release
23+
sudo cp target/release/rcl /usr/local/bin/
24+
25+
- name: Build recipe files
26+
id: rcl
27+
run: |
28+
RCL_OUTPUT=$(rcl build ./100-rcl/recipes.rcl)
29+
RECIPE_FILENAMES=$(echo "$RCL_OUTPUT" | awk '{ print $2 }' | sed -e 's/^recipes\///')
30+
RECIPE_FILENAMES_JSON=$(echo "$RECIPE_FILENAMES" | jq --compact-output --raw-input '[inputs]')
31+
MATRIX_JSON=$(jq -cn --argjson recipes "${RECIPE_FILENAMES_JSON[@]}" '{ recipes: $recipes }')
32+
33+
echo "recipe-matrix=$MATRIX_JSON" >> $GITHUB_OUTPUT
34+
35+
- uses: actions/upload-artifact@v4
36+
with:
37+
name: recipes
38+
path: ./100-rcl/recipes/
39+
bluebuild:
40+
name: Build Custom Image
41+
runs-on: ubuntu-latest
42+
permissions:
43+
contents: read
44+
packages: write
45+
id-token: write
46+
needs: rcl
47+
strategy:
48+
fail-fast: false # stop GH from cancelling all matrix builds if one fails
49+
matrix: ${{ fromJson(needs.rcl.outputs.recipe-matrix) }}
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: actions/download-artifact@v4
53+
with:
54+
name: recipes
55+
path: ./100-rcl/recipes/
56+
57+
- name: Build Custom Image
58+
uses: blue-build/[email protected]
59+
with:
60+
recipe: ${{ matrix.recipe }}
61+
working_directory: ./100-rcl
62+
cosign_private_key: ${{ secrets.SIGNING_SECRET }}
63+
registry_token: ${{ github.token }}
64+
pr_event_number: ${{ github.event.number }}
65+
skip_checkout: true

100-rcl/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.yml

100-rcl/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Easy build matrixing with [RCL](https://rcl-lang.org/)
2+

100-rcl/recipes.rcl

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
let project = {
2+
name = "test",
3+
description = "My test project.",
4+
base-images = "ghcr.io/ublue-os"
5+
};
6+
7+
let gts-version = 40;
8+
9+
{
10+
for base-image in ["kinoite", "silverblue"]:
11+
for nvidia in [true, false]:
12+
for image-version in [gts-version, "latest"]:
13+
14+
let nvidia-suffix = if nvidia: "-nvidia" else: "";
15+
16+
f"recipes/recipe-{base-image}{nvidia-suffix}-{image-version}.yml": {
17+
format = "json",
18+
contents = {
19+
name = f"{project.name}-{base-image}{nvidia-suffix}",
20+
description =
21+
f"""
22+
{project.description}
23+
({base-image}{nvidia-suffix} edition, {if image-version == gts-version: "GTS" else "latest"} version)
24+
""",
25+
26+
base-image = f"{project.base-images}/{base-image}{nvidia-suffix}",
27+
image-version = image-version,
28+
29+
if image-version == gts-version:
30+
alt-tags = [
31+
"gts"
32+
],
33+
34+
modules = [
35+
{
36+
type = "files",
37+
files = [
38+
{
39+
source = "system",
40+
destination = "/",
41+
},
42+
if nvidia:
43+
{
44+
source = "system_nvidia",
45+
destination = "/",
46+
}
47+
]
48+
},
49+
{
50+
type = "default-flatpaks",
51+
user = {
52+
install = [
53+
"org.kde.krita",
54+
"org.fedoraproject.MediaWriter"
55+
]
56+
}
57+
},
58+
if nvidia: {
59+
type = "script",
60+
script = "nvidia-setup.sh"
61+
},
62+
{ type = "signing" }
63+
]
64+
}
65+
}
66+
}

0 commit comments

Comments
 (0)