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:
63
.github/workflows/build.yaml
vendored
Normal file
63
.github/workflows/build.yaml
vendored
Normal 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 }}
|
||||||
57
.github/workflows/release.yaml
vendored
Normal file
57
.github/workflows/release.yaml
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '**'
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
id-token: write
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: static
|
||||||
|
file: Dockerfile.static
|
||||||
|
tag: static
|
||||||
|
- name: dynamic
|
||||||
|
file: Dockerfile
|
||||||
|
tag: latest
|
||||||
|
- name: MXE
|
||||||
|
file: Dockerfile.mxe
|
||||||
|
tag: mxe
|
||||||
|
name: ${{ matrix.name }}
|
||||||
|
uses: ./.github/workflows/build.yaml
|
||||||
|
with:
|
||||||
|
file: ${{ matrix.file }}
|
||||||
|
tag: ${{ matrix.tag }}
|
||||||
|
mxe_win:
|
||||||
|
needs: [build]
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- name: Win32 Static
|
||||||
|
file: Dockerfile.win32s
|
||||||
|
tag: win32s
|
||||||
|
- name: Win32 Dynamic
|
||||||
|
file: Dockerfile.win32d
|
||||||
|
tag: win32d
|
||||||
|
- name: Win64 Static
|
||||||
|
file: Dockerfile.win64s
|
||||||
|
tag: win64s
|
||||||
|
- name: Win64 Dynamic
|
||||||
|
file: Dockerfile.win64d
|
||||||
|
tag: win64d
|
||||||
|
name: MXE ${{ matrix.name }}
|
||||||
|
uses: ./.github/workflows/build.yaml
|
||||||
|
with:
|
||||||
|
file: ${{ matrix.file }}
|
||||||
|
tag: ${{ matrix.tag }}
|
||||||
Reference in New Issue
Block a user