68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
---
|
|
name: Build Autoupdater Image
|
|
|
|
concurrency:
|
|
group: build-image
|
|
cancel-in-progress: false
|
|
|
|
on:
|
|
schedule:
|
|
# Monthly, to pick up bookworm point releases and security updates;
|
|
# :latest is overwritten each time.
|
|
- cron: "0 3 1 * *"
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- dockerfile
|
|
- .dockerignore
|
|
- .gitea/workflows/build-image.yaml
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
# No Debian needed here -- this only drives docker. The *image* is Debian.
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Log in to the Gitea container registry
|
|
env:
|
|
GIT_HOST: ${{ vars.GIT_HOST || 'git.bjphoster.com' }}
|
|
REGISTRY_USER: ${{ vars.REGISTRY_USER }}
|
|
GIT_TOKEN: ${{ secrets.GIT_TOKEN }}
|
|
run: |
|
|
set -euo pipefail
|
|
# NB: this is the Gitea *username*, not vars.GIT_NAME -- that one is
|
|
# the display name used for git commit authorship and contains spaces.
|
|
printf '%s' "${GIT_TOKEN}" \
|
|
| docker login "${GIT_HOST}" \
|
|
--username "${REGISTRY_USER}" \
|
|
--password-stdin
|
|
|
|
- name: Build and push
|
|
env:
|
|
GIT_HOST: ${{ vars.GIT_HOST || 'git.bjphoster.com' }}
|
|
run: |
|
|
set -euo pipefail
|
|
# The repo is `.autoupdate`, but OCI names cannot start with a dot.
|
|
image="${GIT_HOST}/deb/autoupdate"
|
|
|
|
# --pull so a monthly rebuild actually picks up a new base image
|
|
# rather than reusing a cached one.
|
|
docker build --pull --tag "${image}:latest" .
|
|
docker push "${image}:latest"
|
|
|
|
echo "pushed ${image}:latest"
|
|
|
|
- name: Log out
|
|
if: always()
|
|
env:
|
|
GIT_HOST: ${{ vars.GIT_HOST || 'git.bjphoster.com' }}
|
|
run: docker logout "${GIT_HOST}" || true
|