docker-dind-fedora/.forgejo/workflows/build.yml
Renovate Bot 3ab8cebfb8
All checks were successful
renovate/stability-days Updates have met minimum release age requirement
build / docker (pull_request) Successful in 14m11s
chore(deps): update https://github.com/docker/login-action action to v4.8.0
2026-11-08 14:25:49 +00:00

92 lines
3 KiB
YAML

name: build
on:
push:
branches:
- main
paths-ignore:
- '**/README.md'
pull_request:
branches:
- 'main'
schedule:
- cron: "@weekly"
jobs:
docker:
runs-on: lxc
steps:
- name: Set up Docker
run: curl -fsSL https://get.docker.com | sh
- name: Decide whether to build
id: gate
env:
IMAGE: git.xlion.tw/xlionjuan/docker-dind-fedora:latest
run: |
if [ "$FORGEJO_EVENT_NAME" != "schedule" ]; then
echo "build=true" >> "$FORGEJO_OUTPUT"
exit 0
fi
docker pull "$IMAGE"
set +e
docker run --rm "$IMAGE" /bin/bash -c 'dnf5 --refresh -q check-upgrade >/dev/null'
rc=$?
set -e
case "$rc" in
0)
echo "No package updates; skipping build."
echo "build=false" >> "$FORGEJO_OUTPUT"
;;
100)
echo "Package updates are available; continuing build."
echo "build=true" >> "$FORGEJO_OUTPUT"
;;
*)
echo "DNF5 update check failed with exit code $rc." >&2
exit "$rc"
;;
esac
- name: Checkout
if: ${{ steps.gate.outputs.build == 'true' }}
uses: https://git.xlion.tw/actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Login to Docker Hub
if: ${{ steps.gate.outputs.build == 'true' }}
uses: https://github.com/docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
with:
username: ${{ github.actor }}
password: ${{ secrets.PUSH_TOKEN }}
registry: git.xlion.tw
- name: Extract metadata for Docker
if: ${{ steps.gate.outputs.build == 'true' }}
id: meta
uses: https://github.com/docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: git.xlion.tw/${{ github.repository }}
flavor: |
latest=false
tags: |
type=raw,value={{date 'YYYYMMDD'}},enable={{is_default_branch}}
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
labels: |
org.opencontainers.image.description=Born because official Docker dind image always delay the release when they published bug releases. This image only intend for host OS that using SELinux/Apparmor and using with CI runner like Forgejo Actions.
- name: Set up QEMU
if: ${{ steps.gate.outputs.build == 'true' }}
uses: https://github.com/docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
- name: Build and push
if: ${{ steps.gate.outputs.build == 'true' }}
uses: https://github.com/docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
with:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
push: true