refactor: rename fedora version to os version

this change makes sense for when in the future it's possible to
build other OS's with this same system
it was done now, because i'm bundling a bunch of breaking changes
into a single update
This commit is contained in:
ER 2023-08-13 18:00:58 +03:00
parent 1d7b14b38f
commit 38dda90a23
6 changed files with 12 additions and 12 deletions

View file

@ -45,8 +45,8 @@ jobs:
id-token: write
strategy:
fail-fast: false
matrix:
matrix:
# Add recipes for all the images you want to build here.
# Don't add module configuration files, you will get errors.
recipe:
@ -64,13 +64,13 @@ jobs:
run: |
echo "IMAGE_NAME=$(yq '.name' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV
echo "IMAGE_DESCRIPTION=$(yq '.description' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV
echo "FEDORA_MAJOR_VERSION=$(yq '.fedora-version' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV
echo "IMAGE_MAJOR_VERSION=$(yq '.image-version' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV
echo "BASE_IMAGE_URL=$(yq '.base-image' ./config/${{ matrix.recipe }})" >> $GITHUB_ENV
- name: Get current version
id: labels
run: |
ver=$(skopeo inspect docker://${{ env.BASE_IMAGE_URL }}:${{ env.FEDORA_MAJOR_VERSION }} | jq -r '.Labels["org.opencontainers.image.version"]')
ver=$(skopeo inspect docker://${{ env.BASE_IMAGE_URL }}:${{ env.IMAGE_MAJOR_VERSION }} | jq -r '.Labels["org.opencontainers.image.version"]')
echo "VERSION=$ver" >> $GITHUB_OUTPUT
- name: Generate tags
@ -146,7 +146,7 @@ jobs:
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
FEDORA_MAJOR_VERSION=${{ env.FEDORA_MAJOR_VERSION }}
IMAGE_MAJOR_VERSION=${{ env.IMAGE_MAJOR_VERSION }}
BASE_IMAGE_URL=${{ env.BASE_IMAGE_URL }}
RECIPE=${{ matrix.recipe }}
IMAGE_REGISTRY=${{ steps.registry_case.outputs.lowercase }}

View file

@ -5,11 +5,11 @@
# in the cloud. The ARGs have default values, but changing those
# does nothing if the image is built in the cloud.
ARG FEDORA_MAJOR_VERSION=38
ARG IMAGE_MAJOR_VERSION=38
# Warning: changing this might not do anything for you. Read comment above.
ARG BASE_IMAGE_URL=ghcr.io/ublue-os/silverblue-main
FROM ${BASE_IMAGE_URL}:${FEDORA_MAJOR_VERSION}
FROM ${BASE_IMAGE_URL}:${IMAGE_MAJOR_VERSION}
# The default recipe set to the recipe's default filename
# so that `podman build` should just work for many people.

View file

@ -15,17 +15,17 @@ get_yaml_array() {
export -f get_yaml_array # this makes the function available to all modules
# Declare dynamically generated variables as read-only and exported
declare -rx IMAGE_NAME BASE_IMAGE FEDORA_VERSION
declare -rx IMAGE_NAME BASE_IMAGE OS_VERSION
# Read configuration variables.
BASE_IMAGE="$(yq '.base-image' "$RECIPE_FILE")"
IMAGE_NAME="$(yq '.name' "$RECIPE_FILE")"
# Automatically determine which Fedora version we're building.
FEDORA_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)"
OS_VERSION="$(grep -Po '(?<=VERSION_ID=)\d+' /usr/lib/os-release)"
# Welcome.
echo "Building $IMAGE_NAME from Fedora $FEDORA_VERSION ($BASE_IMAGE)."
echo "Building $IMAGE_NAME from $BASE_IMAGE:$OS_VERSION."
# Run each module
readarray MODULES < <(yq -o=j -I=0 '.modules[]' "$RECIPE_FILE" )

View file

@ -1,6 +1,6 @@
type: rpm-ostree
repos:
# - https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%FEDORA_VERSION%/atim-starship-fedora-%FEDORA_VERSION%.repo
# - https://copr.fedorainfracloud.org/coprs/atim/starship/repo/fedora-%OS_VERSION%/atim-starship-fedora-%OS_VERSION%.repo
install:
- python3-pip
- libadwaita

View file

@ -1,7 +1,7 @@
name: startingpoint
description: A starting point for further customization of uBlue images. Make your own! https://ublue.it/making-your-own/
base-image: ghcr.io/ublue-os/silverblue-main
fedora-version: 38
image-version: 38
modules:
- type: script

View file

@ -7,7 +7,7 @@ get_yaml_array REPOS '.repos[]' "$1"
if [[ ${#REPOS[@]} -gt 0 ]]; then
echo "Adding repositories"
for REPO in "${REPOS[@]}"; do
REPO="${REPO//%FEDORA_VERSION%/${FEDORA_VERSION}}"
REPO="${REPO//%OS_VERSION%/${OS_VERSION}}"
wget "${REPO}" -P "/etc/yum.repos.d/"
done
fi