Skip to content

chore: remove kernel versions from akmods package names #394

chore: remove kernel versions from akmods package names

chore: remove kernel versions from akmods package names #394

Workflow file for this run

name: Build kmods
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "0 0 * * *" # Every day at 12:00am
workflow_dispatch:
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}
jobs:
build:
name: Build kmods
runs-on: ${{ matrix.arch == 'x64' && 'ubuntu-latest' || format('runs-on,runner=1cpu-linux-{0},run-id={1}', matrix.arch, github.run_id) }}
strategy:
fail-fast: false
matrix:
fedora-version: [40, 41, stable]
kmod-name: [nvidia-open]
arch: [x64]
env:
IMAGE_NAME: akmods/${{ matrix.kmod-name }}
FEDORA_VERSION: ${{ matrix.fedora-version }}
ARCH: ${{ matrix.arch == 'x64' && 'x86_64' || format('{0}', matrix.arch) }}
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
- name: Generate Image Metadata
id: generate-meta
shell: bash
run: |
tags=()
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-${{ env.ARCH }}")
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-$(date +%Y%m%d%H%M%S)-${{ env.ARCH }}")
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-${GITHUB_SHA::7}-${{ env.ARCH }}")
echo "tags=${tags[*]}" >> $GITHUB_OUTPUT
concat_tags=$(IFS=, ; echo "${tags[*]}")
echo "concat_tags=$concat_tags" >> $GITHUB_OUTPUT
- name: Fetch akmods signing key
run: |
echo "${{ secrets.AKMODS_PRIVATE_KEY }}" > _certs/private_key.priv
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
- name: Login to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get CoreOS Kernel Information
if: ${{ env.FEDORA_VERSION == 'stable' || env.FEDORA_VERSION == 'testing' }}
uses: rsturla/eternal-main/.github/actions/get-coreos-kernel@main
id: get-coreos-kernel
with:
coreos-stream: ${{ env.FEDORA_VERSION }}
- name: Set CoreOS Environment Variables
if: ${{ env.FEDORA_VERSION == 'stable' || env.FEDORA_VERSION == 'testing' }}
run: |
echo "COREOS_KERNEL=${{ steps.get-coreos-kernel.outputs.coreos-kernel-release }}" >> $GITHUB_ENV
echo "FEDORA_VERSION=${{ steps.get-coreos-kernel.outputs.coreos-repo-version }}" >> $GITHUB_ENV
- name: Build Image
id: build-image
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
with:
file: ./Containerfile
context: .
push: ${{ github.event_name != 'pull_request' }}
platforms: ${{ env.ARCH == 'x86_64' && 'linux/amd64' || format('linux/{0}', env.ARCH) }}
tags: ${{ steps.generate-meta.outputs.concat_tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
KMOD_NAME=${{ matrix.kmod-name }}
FEDORA_KERNEL_FLAVOR=${{ matrix.fedora-version }}
FEDORA_VERSION=${{ env.FEDORA_VERSION }}
manifest:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix:
fedora-version: [40, 41, stable]
kmod-name: [nvidia-open]
env:
IMAGE_NAME: akmods/${{ matrix.kmod-name }}
FEDORA_VERSION: ${{ matrix.fedora-version }}
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Generate tags
id: generate-tags
run: |
tags=()
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}")
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-$(date +%Y%m%d%H%M%S)")
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-${GITHUB_SHA::7}")
echo "tags=${tags[*]}" >> $GITHUB_OUTPUT
- name: Create Manifest
run: |
podman manifest create ${{ env.IMAGE_NAME }}
podman manifest add --all ${{ env.IMAGE_NAME }} ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-x86_64
- name: Login to GHCR
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Manifest
run: |
for tag in ${{ steps.generate-tags.outputs.tags }}; do
podman manifest push --all=false ${{ env.IMAGE_NAME }} $tag
done
check:
needs: [build, manifest]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
- name: Exit on failure
if: ${{ needs.build.result == 'failure' }}
shell: bash
run: exit 1
- name: Exit on success
shell: bash
run: exit 0