Skip to content

Commit

Permalink
feat: Use variables more extensively in build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-stone committed Mar 4, 2023
1 parent 3a6a268 commit 4d451ce
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ on:
workflow_dispatch:

env:
IMAGE_BASE_NAME: nvidia
REPO: ${{ github.repository }}
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:
push-ghcr:
name: Build and push image
Expand Down Expand Up @@ -56,6 +57,11 @@ jobs:
- name: Checkout Push to Registry action
uses: actions/checkout@v3

- name: Matrix Variables
run: |
REPO_NAME=${{ env.REPO }}
echo ${REPO_NAME##*/}
echo "IMAGE_NAME=${{ matrix.image_name }}-${REPO_NAME##*/}" >> $GITHUB_ENV
- name: Generate tags
id: generate-tags
shell: bash
Expand Down Expand Up @@ -133,11 +139,11 @@ jobs:
id: meta
with:
images: |
${{ format('{0}-nvidia', matrix.image_name) }}
$IMAGE_NAME
labels: |
org.opencontainers.image.title=${{ format('{0}-nvidia', matrix.image_name) }}
org.opencontainers.image.description=Vanilla ${{ matrix.image_name }} with Nvidia drivers added
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/ublue-os/nvidia/main/README.md
org.opencontainers.image.title=$IMAGE_NAME
org.opencontainers.image.description=ublue-os $IMAGE_NAME with Nvidia drivers added
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/${{ github.repository }}/main/README.md
io.artifacthub.package.logo-url=/~https://avatars.githubusercontent.com/u/1728152?s=200&v=4
# Build image using Buildah action
- name: Build Image
Expand All @@ -146,9 +152,7 @@ jobs:
with:
containerfiles: |
./Containerfile
# Postfix image name with -nvidia to make it a little more descriptive
# Syntax: https://docs.github.com/en/actions/learn-github-actions/expressions#format
image: ${{ format('{0}-nvidia', matrix.image_name) }}
image: ${{ env.IMAGE_NAME }}
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
Expand Down

0 comments on commit 4d451ce

Please sign in to comment.