Skip to content

Bump docker/build-push-action from 5 to 6 #161

Bump docker/build-push-action from 5 to 6

Bump docker/build-push-action from 5 to 6 #161

Workflow file for this run

---
name: CI
# yamllint disable-line rule:truthy
on:
push:
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
permissions:
pull-requests: write
contents: write
jobs:
information:
name: Gather add-on information
runs-on: ubuntu-latest
outputs:
containersha: ${{ steps.information.outputs.containersha }}
description: ${{ steps.information.outputs.description }}
environment: ${{ steps.information.outputs.environment }}
name: ${{ steps.information.outputs.name }}
version: ${{ steps.information.outputs.version }}
build_date: ${{ steps.information.outputs.build_date }}
api_url: ${{ steps.information.outputs.api_url }}
steps:
- name: ‡️ Check out code from GitHub
uses: actions/checkout@v4
- name: ℹ️ Gather version and environment
id: information
# yamllint disable rule:line-length
run: |
sha="${{ github.sha }}"
environment="edge"
version="${sha:0:7}"
echo "::set-output name=containersha::${version}"
if [[ "${{ github.event_name }}" = "release" ]]; then
version="${{ github.event.release.tag_name }}"
version="${version,,}"
version="${version#v}"
environment="stable"
if [[ "${{ github.event.release.prerelease }}" = "true" ]]; then
environment="beta"
fi
fi
echo "::set-output name=environment::${environment}"
echo "::set-output name=version::${version}"
echo "::set-output name=name::xteve with cuda ffmpeg ${environment}"
echo "::set-output name=description::xteve with cuda ffmpeg ${environment} in a container"
# yamllint enable rule:line-length
build:
strategy:
matrix:
version: [12.3.1, 12.2.2, 12.0.1, 12.0.0, 11.8.0]
os: [ubuntu22.04]
name: πŸ‘· Build CUDA ${{ matrix.version }} on ${{ matrix.os }}
needs:
- information
runs-on: ubuntu-latest
steps:
- name: ‡️ Check out code from GitHub
uses: actions/checkout@v4
- name: πŸ“ Docker meta
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
latest=false
prefix=
suffix=
# list of Docker images to use as base name for tags
images: |
troykelly/xteve-nvidia-cuda-ffmpeg
ghcr.io/troykelly/xteve-nvidia-cuda-ffmpeg
# generate Docker tags based on the following events/attributes
tags: |
type=schedule,prefix=${{ matrix.version }}-${{ matrix.os }}-
type=ref,event=branch,prefix=${{ matrix.version }}-${{ matrix.os }}-
type=ref,event=pr,prefix=${{ matrix.version }}-${{ matrix.os }}-
type=sha,prefix=${{ matrix.version }}-${{ matrix.os }}-
type=edge,enable=true,priority=700prefix=${{ matrix.version }}-${{ matrix.os }}-,suffix=,branch=$repo.default_branch
type=edge,enable=${{ matrix.version == '12.3.1' && matrix.os == 'ubuntu22.04' }},prefix=,suffix=
- name: πŸ— Set up QEMU
uses: docker/setup-qemu-action@v3
- name: πŸ— Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: πŸ— Login to Docker Container Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: πŸ— Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CI_PAT }}
- name: πŸš€ Build
uses: docker/build-push-action@v6
with:
push: true
builder: ${{ steps.buildx.outputs.name }}
context: ./
file: ./xteve/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
# yamllint disable-line rule:line-length
# platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64/v8
platforms: linux/amd64
build-args: |
BUILD_DATE=${{ needs.information.outputs.version }}
BUILD_DESCRIPTION=${{ needs.information.outputs.description }}
BUILD_NAME=${{ needs.information.outputs.name }}
BUILD_REF=${{ github.sha }}
BUILD_REPOSITORY=${{ github.repository }}
BUILD_VERSION=${{ needs.information.outputs.version }}
CUDA=${{ matrix.version }}
OS=${{ matrix.os }}
dependabot:
runs-on: ubuntu-latest
# Checking the actor will prevent your Action run failing on non-Dependabot
# PRs but also ensures that it only does work for Dependabot PRs.
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
# This first step will fail if there's no metadata and so the approval
# will not occur.
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/fetch-metadata@v1.6.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
# Here the PR gets approved.
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Finally, this sets the PR to allow auto-merging for patch and minor
# updates if all checks pass
- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }}
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}