Skip to content

Commit

Permalink
generate build args
Browse files Browse the repository at this point in the history
  • Loading branch information
p5 committed Dec 21, 2024
1 parent 6abd04d commit 724dd5c
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build-kinoite-40.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
fedora-version: 40
image-registry: ghcr.io/ublue-os
image-name: kinoite-main
source-image: kinoite
is-gts: true

build:
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/reusable-generate-metadata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: "The name of the image to build"
required: true
type: string
source-image:
description: "The source image to build from"
required: true
type: string
is-latest:
description: "Is this the latest version"
required: false
Expand Down Expand Up @@ -51,10 +55,13 @@ jobs:
image-registry: ${{ inputs.image-registry }}
image-name: ${{ inputs.image-name }}
build-args: ${{ steps.set-metadata.outputs.BUILD_ARGS }}
tags: ${{ steps.generate-tags.outputs.TAGS }}
tags: ${{ steps.set-metadata.outputs.TAGS }}
steps:
- name: Fetch Kernel Version
id: fetch-kernel-version
env:
IMAGE_REGISTRY: ${{ inputs.image-registry }}
FEDORA_VERSION: ${{ inputs.fedora-version }}
run: |
KERNEL_VERSION=$(skopeo inspect docker://${IMAGE_REGISTRY}/main-kernel:${FEDORA_VERSION} | jq -r '.Labels["ostree.linux"]')
Expand All @@ -66,6 +73,7 @@ jobs:
IS_LATEST_VERSION: ${{ inputs.is-latest }}
IS_GTS_VERSION: ${{ inputs.is-gts }}
IS_BETA_VERSION: ${{ inputs.is-beta }}
FEDORA_VERSION: ${{ inputs.fedora-version }}
run: |
TIMESTAMP="$(date +%Y%m%d)"
SHA_SHORT="${GITHUB_SHA::7}"
Expand All @@ -89,3 +97,29 @@ jobs:
done
echo "TAGS=$(IFS=,; echo "${TAGS[*]}")" >> $GITHUB_OUTPUT
- name: Generate Build Args
id: generate-build-args
env:
KERNEL_VERSION: ${{ steps.fetch-kernel-version.outputs.KERNEL_VERSION }}
FEDORA_VERSION: ${{ inputs.fedora-version }}
IMAGE_NAME: ${{ inputs.image-name }}
SOURCE_IMAGE: ${{ inputs.source-image }}
run: |
BUILD_ARGS=()
BUILD_ARGS+=("KERNEL_VERSION=${KERNEL_VERSION}")
BUILD_ARGS+=("SOURCE_IMAGE=${SOURCE_IMAGE}")
BUILD_ARGS+=("FEDORA_MAJOR_VERSION=${FEDORA_VERSION}")
BUILD_ARGS+=("IMAGE_NAME=${IMAGE_NAME}")
echo "BUILD_ARGS=$(IFS=,; echo "${BUILD_ARGS[*]}")" >> $GITHUB_OUTPUT
- name: Set Metadata
id: set-metadata
env:
BUILD_ARGS: ${{ steps.generate-build-args.outputs.BUILD_ARGS }}
TAGS: ${{ steps.generate-tags.outputs.TAGS }}
run: |
echo "BUILD_ARGS=${BUILD_ARGS}" >> $GITHUB_OUTPUT
echo "TAGS=${TAGS}" >> $GITHUB_OUTPUT

0 comments on commit 724dd5c

Please sign in to comment.