build image with shared traberph/ci workflow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 19:18:44 +02:00
co-authored by Claude Opus 5.5
parent 810eebf09d
commit bf06e79bbe
2 changed files with 22 additions and 44 deletions
+11 -36
View File
@@ -7,42 +7,17 @@ on:
pull_request:
workflow_dispatch:
env:
REGISTRY: registry.traberph.de
IMAGE: registry.traberph.de/public/interval_viz
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Log in to registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
# Tags and build steps are shared across repos, see traberph/ci.
image:
uses: traberph/ci/.gitea/workflows/image.yaml@main
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Image tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}
# main-<sha>-<unix time> sorts by build time, for Flux image automation
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=main-{{sha}}-{{date 'X'}},enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
project: public
image: interval_viz
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
secrets:
registry-username: ${{ secrets.REGISTRY_USERNAME }}
registry-token: ${{ secrets.REGISTRY_TOKEN }}
# Public image; also pushed to Docker Hub once these secrets exist.
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }}
+9 -6
View File
@@ -92,19 +92,22 @@ credentials are set in `docker-compose.yml`. The host port can be changed with
## CI: build and push
`.gitea/workflows/docker.yml` builds the image with Gitea Actions and pushes it
`.gitea/workflows/docker.yml` builds the image (`linux/amd64`, `linux/arm64`) with the
shared [`traberph/ci`](https://git.traberph.de/traberph/ci) image workflow and pushes it
to the Harbor registry as `registry.traberph.de/public/interval_viz`.
| Trigger | Tags pushed |
|--------------------|------------------------------------------------------|
| push to `main` | `latest`, `main-<sha>-<unix time>` (e.g. `main-6cecbcf-1790415657`) |
| tag `v1.2.3` | `1.2.3`, `1.2` |
| push to `main` | `latest`, `<UTC yyyymmddHHMMSS>-<sha7>` (e.g. `20261016171500-6cecbcf`) |
| tag `v1.2.3` | `1.2.3`, `1.2`, `1`, `<UTC yyyymmddHHMMSS>-<sha7>` |
| pull request | build only, nothing pushed |
| manual dispatch | as for the selected ref |
The `main-…` tags sort by build time via the trailing timestamp. Flux image
automation can pick the newest one with this filter:
`pattern: '^main-[a-f0-9]+-(?P<ts>[0-9]+)$'`, `extract: '$ts'`, `numerical: asc`.
The timestamp tags sort by build time. Flux image automation picks the newest one with
this filter: `pattern: '^(?P<ts>[0-9]{14})-[a-f0-9]{7}$'`, `extract: '$ts'`, `numerical: asc`.
With the `DOCKERHUB_USERNAME` and `DOCKERHUB_TOKEN` secrets set, the same tags are also
pushed to `docker.io/<DOCKERHUB_USERNAME>/interval_viz`.
Old tags are cleaned up by a tag retention policy in Harbor, not by this workflow.