Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 64 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,85 @@ concurrency:
cancel-in-progress: true

jobs:
changes:
name: Determine which variants need building
runs-on: ubuntu-24.04
outputs:
variants: ${{ steps.set-matrix.outputs.variants }}
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0 # paths-filter needs history to diff against on push events

- name: Detect changed layers
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
shared:
- '.github/workflows/build.yml'
- 'yum-repos/**'
- 'build.sh'
- 'push.sh'
- 'build_scripts/install-base.sh'
- 'build_scripts/clean-base.sh'
base:
- 'Containerfile.base'
desktop:
- 'Containerfile.desktop'
- 'build_scripts/install-desktop.sh'
- 'build_scripts/clean-desktop.sh'
laptop:
- 'Containerfile.laptop'
- 'build_scripts/install-desktop.sh'
- 'build_scripts/clean-desktop.sh'
- 'build_scripts/install-laptop.sh'
- 'build_scripts/clean-laptop.sh'
- 'dracut.conf'

- name: Build matrix list
id: set-matrix
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo 'variants=["base","desktop","laptop"]' >> "${GITHUB_OUTPUT}"
exit 0
fi

variants=()
[ "${{ steps.filter.outputs.shared }}" = "true" ] && variants+=("base" "desktop" "laptop")
[ "${{ steps.filter.outputs.base }}" = "true" ] && variants+=("base")
[ "${{ steps.filter.outputs.desktop }}" = "true" ] && variants+=("desktop")
[ "${{ steps.filter.outputs.laptop }}" = "true" ] && variants+=("laptop")

unique=$(printf '%s\n' "${variants[@]}" | sort -u | jq -R . | jq -s -c 'map(select(length > 0))')
echo "variants=${unique}" >> "${GITHUB_OUTPUT}"

build_push:
name: Build and push ${{ matrix.variant }} image
needs: changes
if: needs.changes.outputs.variants != '[]'
runs-on: ubuntu-24.04
timeout-minutes: 40

strategy:
fail-fast: false
matrix:
variant: [base, desktop, laptop]
variant: ${{ fromJson(needs.changes.outputs.variants) }}

permissions:
contents: read
packages: write
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v5

- name: Lowercase image name
- name: Set build env vars
run: |
echo "IMAGE_REGISTRY=${IMAGE_REGISTRY,,}" >> ${GITHUB_ENV}
echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV}
echo "IMAGE_REGISTRY=${IMAGE_REGISTRY,,}" >> "${GITHUB_ENV}"
echo "IMAGE_NAME=${IMAGE_NAME,,}" >> "${GITHUB_ENV}"
echo "TIMESTAMP=$(date -u +%Y%m%d)" >> "${GITHUB_ENV}"

- name: Login to GHCR
run: |
Expand All @@ -50,9 +107,9 @@ jobs:
run: |
CACHE_PUSH="false"
if [ "${{ github.event_name }}" != "pull_request" ]; then CACHE_PUSH="true"; fi
./build.sh "${{ matrix.variant }}" "${{ env.IMAGE_NAME }}" "${{ env.IMAGE_REGISTRY }}" $CACHE_PUSH
./build.sh "${{ matrix.variant }}" "${{ env.IMAGE_NAME }}" "${{ env.IMAGE_REGISTRY }}" $CACHE_PUSH "${{ env.TIMESTAMP }}"

- name: Push ${{ matrix.variant }} image
if: github.event_name != 'pull_request'
run: |
./push.sh "${{ matrix.variant }}" "${{ env.IMAGE_NAME }}" "${{ env.IMAGE_REGISTRY }}"
./push.sh "${{ matrix.variant }}" "${{ env.IMAGE_NAME }}" "${{ env.IMAGE_REGISTRY }}" "${{ env.TIMESTAMP }}"
2 changes: 1 addition & 1 deletion Containerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM ghcr.io/nushell/nushell:latest-alpine as nushell
FROM quay.io/fedora/fedora-bootc:44

COPY --from=nushell /usr/bin/nu /usr/bin/nu
RUN printf '/bin/nu\n/usr/bin/nu' >> /etc/shells
RUN printf '/bin/nu\n/usr/bin/nu\n' >> /etc/shells

COPY yum-repos/custom.repo /etc/yum.repos.d/custom.repo

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ VARIANT=${1:?VARIANT required (base|desktop|laptop)}
IMAGE_NAME=${2:?IMAGE_NAME required}
IMAGE_REGISTRY=${3:?IMAGE_REGISTRY required}
CACHE_PUSH=${4:?CACHE_PUSH required (true|false)}
TIMESTAMP=${5:?TIMESTAMP required}

FULL_IMAGE="${IMAGE_REGISTRY}/${IMAGE_NAME}"
CACHE_REPO="${FULL_IMAGE}-cache-${VARIANT}"
TIMESTAMP=$(date -u +%Y%m%d)

echo "$(buildah --version)"

Expand Down
24 changes: 0 additions & 24 deletions build_scripts/install-desktop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,6 @@ winetricks \
dnf config-manager setopt "rpmfusion*".enabled=0
echo "::endgroup::"

# ===================== FONTS ======================

echo "::group:: Build Desktop - Fonts"

FONT_NAME="RobotoMono"
FONTS_FOLDER="/usr/share/fonts/${FONT_NAME}"
URL="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${FONT_NAME}.tar.xz"
TMPFILE="$(mktemp /tmp/${FONT_NAME}.XXXXXX.tar.xz)"

mkdir -p "$FONTS_FOLDER"
curl -fL -o "$TMPFILE" "$URL"
tar -xJf "$TMPFILE" -C "$FONTS_FOLDER"

rm -f "$TMPFILE"

fc-cache -vf "$FONTS_FOLDER"

unset FONT_NAME
unset FONTS_FOLDER
unset URL
unset TMPFILE

echo "::endgroup::"

# =================== LIBREWOLF ====================

echo "::group:: Build Desktop - Librewolf"
Expand Down
2 changes: 1 addition & 1 deletion push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ set -ouex pipefail
VARIANT=${1:?VARIANT required (base|desktop|laptop)}
IMAGE_NAME=${2:?IMAGE_NAME required}
IMAGE_REGISTRY=${3:?IMAGE_REGISTRY required}
TIMESTAMP=${4:?TIMESTAMP required}

FULL_IMAGE="${IMAGE_REGISTRY}/${IMAGE_NAME}"
TIMESTAMP=$(date -u +%Y%m%d)

echo "Pushing ${VARIANT} variant of ${FULL_IMAGE}"

Expand Down
Loading