Skip to content

Docker build

Docker build #399

Workflow file for this run

name: Docker build
on:
push:
tags:
- 'v[0-9].[0-9]+.[0-9]+'
workflow_run:
workflows: [ "Tests" ]
types: [ completed ]
jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: Update commit status
uses: haya14busa/action-workflow_run-status@v1
if: ${{ github.event_name == 'workflow_run' }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
name=axeleroy/self-host-planning-poker,enable=${{startsWith(github.ref, 'refs/tags/v')}}
ghcr.io/axeleroy/self-host-planning-poker
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=sha,prefix=,enable=${{startsWith(github.ref, 'refs/tags/v') == 'false' }}
-
name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Build and push
uses: docker/build-push-action@v5
with:
# FIXME: pushes on PRs
push: ${{ (false && github.ref_name == 'main' && github.event.workflow_run.conclusion == 'success' && toJson(github.workflow_run.pull_requests) == 'null') || startsWith(github.ref, 'refs/tags/v') }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# See https://docs.docker.com/build/ci/github-actions/examples/#github-cache
cache-from: type=gha
cache-to: type=gha,mode=max