Skip to content

Add --generate-commit-name flag (#282) #471

Add --generate-commit-name flag (#282)

Add --generate-commit-name flag (#282) #471

Workflow file for this run

name: Docker
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
paths:
- '**.Dockerfile'
- '.github/workflows/docker.yaml'
jobs:
push:
name: 'Build and (conditionally) push Docker images'
strategy:
matrix:
stage: ['cli', 'scan', 'resolution']
docker-os: ['alpine', 'debian']
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=${{ matrix.stage == 'cli' }}
suffix=${{ matrix.docker-os != 'alpine' && format('-{0}', matrix.docker-os) || '' }},onlatest=${{ matrix.docker-os != 'alpine' }}
images: |
debricked/cli
ghcr.io/debricked/cli
tags: |
type=semver,pattern={{version}},enable=${{ matrix.stage == 'cli' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ matrix.stage == 'cli' }}
type=semver,pattern={{major}},enable=${{ matrix.stage == 'cli' }}
type=edge,enable=${{ matrix.stage == 'cli' }}
type=semver,pattern={{version}}-${{ matrix.stage }}
type=semver,pattern={{major}}.{{minor}}-${{ matrix.stage }}
type=semver,pattern={{major}}-${{ matrix.stage }}
type=raw,value=edge-${{ matrix.stage }}
type=raw,value=latest-${{ matrix.stage }}
- name: Build and push ${{ matrix.docker-os }} images
uses: docker/build-push-action@v5
with:
context: .
file: build/docker/${{ matrix.docker-os }}.Dockerfile
target: ${{ matrix.stage }}
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max