Build Nvidia akmods cache #403
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Nvidia akmods cache | |
on: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0,12 * * *' | |
pull_request: | |
workflow_dispatch: | |
env: | |
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} | |
IMAGE_NAME: akmods-nvidia | |
jobs: | |
build: | |
name: Build Nvidia akmods cache | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
fedora-version: [38, 39] | |
nvidia-version: [535] | |
permissions: | |
contents: read | |
packages: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Generate Image Metadata | |
id: generate-meta | |
shell: bash | |
run: | | |
tags=() | |
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-${{ matrix.nvidia-version }}") | |
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-${{ matrix.nvidia-version }}-$(date +%Y%m%d%H%M%S)") | |
tags+=("${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.fedora-version }}-${{ matrix.nvidia-version }}-${GITHUB_SHA::7}") | |
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/eternal-akmods.priv | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GHCR | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Image | |
id: build-image | |
uses: docker/build-push-action@v4 | |
with: | |
file: nvidia/Containerfile | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.generate-meta.outputs.concat_tags }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
build-args: | | |
NVIDIA_VERSION=${{ matrix.nvidia-version }} | |
FEDORA_VERSION=${{ matrix.fedora-version }} | |
check: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Exit | |
shell: bash | |
run: exit 0 |