Skip to content

chore(deps): bump docker/metadata-action from 5 to 6 #43

chore(deps): bump docker/metadata-action from 5 to 6

chore(deps): bump docker/metadata-action from 5 to 6 #43

Workflow file for this run

name: Publish Docker image

Check failure on line 1 in .github/workflows/docker-publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-publish.yml

Invalid workflow file

(Line: 56, Col: 9): Unrecognized named-value: 'matrix'. Located at position 112 within expression: github.event.inputs.variant == null || github.event.inputs.variant == 'both' || github.event.inputs.variant == matrix.variant
on:
push:
branches:
- master
tags:
- "v*.*.*"
paths-ignore:
- 'docs/**'
- '**.md'
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
- '**.md'
workflow_dispatch:
inputs:
variant:
description: 'Which variant to build'
required: true
default: 'both'
type: choice
options:
- both
- cpu
- cuda
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
name: Build & push (${{ matrix.variant }})
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- variant: cpu
dockerfile: Dockerfile
tag_suffix: ""
- variant: cuda
dockerfile: Dockerfile.cuda
tag_suffix: "-cuda"
if: |
github.event.inputs.variant == null ||
github.event.inputs.variant == 'both' ||
github.event.inputs.variant == matrix.variant
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set lowercase image name
id: image
run: |
echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to ghcr.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}
tags: |
type=raw,value=latest${{ matrix.tag_suffix }},enable={{is_default_branch}}
type=semver,pattern={{version}},suffix=${{ matrix.tag_suffix }}
type=semver,pattern={{major}}.{{minor}},suffix=${{ matrix.tag_suffix }}
type=ref,event=pr,suffix=${{ matrix.tag_suffix }}
- name: Free disk space
if: matrix.variant == 'cuda'
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/share/boost
df -h
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./${{ matrix.dockerfile }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=${{ matrix.variant }}
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}
- name: Image published
if: github.event_name != 'pull_request'
run: |
echo "[${{ matrix.variant }}] published:"
echo " docker pull ${{ env.REGISTRY }}/${{ steps.image.outputs.name }}:latest${{ matrix.tag_suffix }}"