refactor: simplify some variable names

This commit is contained in:
Benjamin Sherman 2023-08-26 20:09:48 -05:00
parent 2a26bae17c
commit 0752d0772f
No known key found for this signature in database
GPG key ID: 24E3D151565CA98B
3 changed files with 26 additions and 25 deletions

View file

@ -18,11 +18,12 @@ on:
# The values here are defaults and should be modified if using a different image, needing
# nvidia, a specific nvidia driver, or a different Fedora version.
env:
ARG_IMAGE_NAME: "silverblue"
ARG_IMAGE_SUFFIX: "main"
ARG_FEDORA_MAJOR_VERSION: "38"
ARG_NVIDIA_MAJOR_VERSION: ""
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
ARG_SOURCE_IMAGE: "silverblue"
ARG_SOURCE_SUFFIX: "main"
ARG_FEDORA_VERSION: "38"
ARG_NVIDIA_VERSION: ""
IMAGE_REGISTRY: "ghcr.io/${{ github.repository_owner }}"
MY_IMAGE_NAME: "customzed-ublue"
jobs:
push-ghcr:
@ -45,7 +46,7 @@ jobs:
run: |
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
VARIANT="${{ env.ARG_FEDORA_MAJOR_VERSION }}"
VARIANT="${{ env.ARG_FEDORA_VERSION }}"
COMMIT_TAGS=()
BUILD_TAGS=()
@ -89,7 +90,7 @@ jobs:
- name: Get current version
id: labels
run: |
ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ env.ARG_IMAGE_NAME }}-${{ env.ARG_IMAGE_SUFFIX }}:${{ env.FEDORA_MAJOR_VERSION}}${{ env.NVIDIA_MAJOR_VERSION}} | jq -r '.Labels["org.opencontainers.image.version"]')
ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ env.ARG_SOURCE_IMAGE }}-${{ env.ARG_SOURCE_SUFFIX }}:${{ env.FEDORA_VERSION}}${{ env.NVIDIA_VERSION}} | jq -r '.Labels["org.opencontainers.image.version"]')
echo "VERSION=$ver" >> $GITHUB_OUTPUT
# Build metadata
@ -98,12 +99,12 @@ jobs:
id: meta
with:
images: |
${{ env.ARG_IMAGE_NAME }}-${{ env.ARG_IMAGE_SUFFIX }}-custom
${{ env.MY_IMAGE_NAME }}
labels: |
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository_owner }}/${{ github.repository_name }}/main/README.md
org.opencontainers.image.description=Customized ${{ env.ARG_IMAGE_NAME }}-${{ env.ARG_IMAGE_SUFFIX }} image.
org.opencontainers.image.title=${{ env.ARG_IMAGE_NAME }}-${{ env.ARG_IMAGE_SUFFIX }}
org.opencontainers.image.description=Customized ${{ env.ARG_SOURCE_IMAGE }}-${{ env.ARG_SOURCE_SUFFIX }} image.
org.opencontainers.image.title=${{ env.MY_IMAGE_NAME }}
org.opencontainers.image.version=${{ steps.labels.outputs.VERSION }}
# Build image using Buildah action
@ -115,14 +116,14 @@ jobs:
./Containerfile
# Postfix image name with -custom to make it a little more descriptive
# Syntax: https://docs.github.com/en/actions/learn-github-actions/expressions#format
image: ${{ env.ARG_IMAGE_NAME }}-${{ env.ARG_IMAGE_SUFFIX }}-custom
image: ${{ env.MY_IMAGE_NAME }}
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
IMAGE_NAME=${{ env.ARG_IMAGE_NAME }}
IMAGE_SUFFIX=${{ env.ARG_IMAGE_SUFFIX }}
FEDORA_MAJOR_VERSION=${{ env.ARG_FEDORA_MAJOR_VERSION }}
NVIDIA_MAJOR_VERSION=${{ env.ARG_NVIDIA_MAJOR_VERSION }}
SOURCE_IMAGE=${{ env.ARG_SOURCE_IMAGE }}
SOURCE_SUFFIX=${{ env.ARG_SOURCE_SUFFIX }}
FEDORA_VERSION=${{ env.ARG_FEDORA_VERSION }}
NVIDIA_VERSION=${{ env.ARG_NVIDIA_VERSION }}
labels: ${{ steps.meta.outputs.labels }}
oci: false

View file

@ -4,20 +4,20 @@
## workflow provides them when building in Github Actions. Changes to the workflow
## build.xml will override changes here.
## IMAGE_NAME arg can be anything from ublue upstream: silverblue, kinoite, sericea, vauxite, mate, lxqt, base
ARG IMAGE_NAME="silverblue"
## IMAGE_SUFFIX arg should be "main", nvidia users should use "nvidia"
ARG IMAGE_SUFFIX="main"
## FEDORA_MAJOR_VERSION arg must be a version built by ublue: 37 or 38 as of today
ARG FEDORA_MAJOR_VERSION="38"
## NVIDIA_MAJOR_VERSION should only be changed if the user needs a specific nvidia driver version
## SOURCE_IMAGE arg can be anything from ublue upstream: silverblue, kinoite, sericea, vauxite, mate, lxqt, base
ARG SOURCE_IMAGE="silverblue"
## SOURCE_SUFFIX arg should be "main", nvidia users should use "nvidia"
ARG SOURCE_SUFFIX="main"
## FEDORA_VERSION arg must be a version built by ublue: 37 or 38 as of today
ARG FEDORA_VERSION="38"
## NVIDIA_VERSION should only be changed if the user needs a specific nvidia driver version
## if needing driver 535, this should be set to "-535". It is important to include the hyphen
ARG NVIDIA_MAJOR_VERSION=""
ARG NVIDIA_VERSION=""
### 2. SOURCE IMAGE
## this is a standard Containerfile FROM using the build ARGs above to select the right upstream image
FROM ghcr.io/ublue-os/${IMAGE_NAME}-${IMAGE_SUFFIX}:${FEDORA_MAJOR_VERSION}${NVIDIA_MAJOR_VERSION}
FROM ghcr.io/ublue-os/${SOURCE_IMAGE}-${SOURCE_SUFFIX}:${FEDORA_VERSION}${NVIDIA_VERSION}
### 3. PRE-MODIFICATIONS

View file

@ -1 +1 @@
# ublue-clean-start
# ublue-custom-start