68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
schedule:
|
|
- cron: "0 18 * * 1"
|
|
|
|
jobs:
|
|
prepare:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- id: set-matrix
|
|
run: "echo \"matrix=$(jq -cr '{image: [.[] | {name, context, dockerfile}]}' images.json)\" >> $GITHUB_OUTPUT"
|
|
build_image:
|
|
runs-on: ubuntu-latest
|
|
needs: prepare
|
|
strategy:
|
|
fail-fast: false
|
|
matrix: ${{ fromJson(needs.prepare.outputs.matrix) }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
- name: Docker Meta
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
flavor: |
|
|
latest=true
|
|
images: |
|
|
jakewalker/${{ matrix.image.name }}
|
|
ghcr.io/jake-walker/${{ matrix.image.name }}
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=sha
|
|
- name: Setup QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
- name: Setup Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ vars.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
- 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@v6
|
|
with:
|
|
context: ${{ matrix.image.context }}
|
|
file: ${{ matrix.image.dockerfile }}
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|