Build Docker images with GitHub Actions (#16)

* WIP GitHub Actions Workflow

* Split into reusable workflow

* Generate MXE and Win builds
This commit is contained in:
David Girón
2024-01-14 00:29:14 +01:00
committed by GitHub
parent fe41273d12
commit 257fa9fb0c
2 changed files with 120 additions and 0 deletions

63
.github/workflows/build.yaml vendored Normal file
View File

@@ -0,0 +1,63 @@
name: Build
on:
workflow_call:
inputs:
file:
required: true
type: string
description: Dockerfile to use
tag:
required: true
type: string
description: Docker tag to generate
load:
required: false
type: boolean
default: false
description: Load docker image
env:
REGISTRY: ghcr.io
IMAGE: ${{ github.repository_owner }}/qt
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to GHCR
uses: docker/login-action@v2
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ${{ env.REGISTRY }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE }}
flavor: |
latest=false
tags: |
type=raw,value=${{ inputs.tag }}
type=ref,event=tag,enable=${{ inputs.tag == 'latest' }}
- name: Build
uses: docker/build-push-action@v4
with:
file: ${{ inputs.file }}
sbom: true
provenance: true
load: ${{ inputs.load || 'false' }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}