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

View file

@ -4,20 +4,20 @@
## workflow provides them when building in Github Actions. Changes to the workflow ## workflow provides them when building in Github Actions. Changes to the workflow
## build.xml will override changes here. ## build.xml will override changes here.
## IMAGE_NAME arg can be anything from ublue upstream: silverblue, kinoite, sericea, vauxite, mate, lxqt, base ## SOURCE_IMAGE arg can be anything from ublue upstream: silverblue, kinoite, sericea, vauxite, mate, lxqt, base
ARG IMAGE_NAME="silverblue" ARG SOURCE_IMAGE="silverblue"
## IMAGE_SUFFIX arg should be "main", nvidia users should use "nvidia" ## SOURCE_SUFFIX arg should be "main", nvidia users should use "nvidia"
ARG IMAGE_SUFFIX="main" ARG SOURCE_SUFFIX="main"
## FEDORA_MAJOR_VERSION arg must be a version built by ublue: 37 or 38 as of today ## FEDORA_VERSION arg must be a version built by ublue: 37 or 38 as of today
ARG FEDORA_MAJOR_VERSION="38" ARG FEDORA_VERSION="38"
## NVIDIA_MAJOR_VERSION should only be changed if the user needs a specific nvidia driver version ## 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 ## 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 ### 2. SOURCE IMAGE
## this is a standard Containerfile FROM using the build ARGs above to select the right upstream 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 ### 3. PRE-MODIFICATIONS

View file

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