Skip to content

tests: derive expected addon target version from Gramps install #8

tests: derive expected addon target version from Gramps install

tests: derive expected addon target version from Gramps install #8

Workflow file for this run

name: Build Docker Images
on:
push:
# No paths filter on purpose. Buildx layer cache makes the rebuild
# a ~20-30 s no-op when nothing under .github/docker/ has changed,
# in exchange for guaranteeing gramps-ci:<suffix> exists on the
# first push to any newly-created maintenance branch.
branches: [maintenance/gramps**]
workflow_dispatch:
env:
REGISTRY: ghcr.io
REPO: ${{ github.repository }}
permissions:
contents: read
packages: write
jobs:
build-ci:
name: Build gramps-ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Compute branch parameters
# Derive the image-tag suffix, Gramps minor series, and upstream
# fallback SHA from the branch ref. Same validation as ci.yml's
# setup job: anything outside maintenance/grampsNN fails fast.
# The fallback SHA is the current tip of gramps-project/gramps
# at the matching maintenance branch; the Dockerfile only uses
# it when no gramps==${series}.* release exists on PyPI. The
# SHA is part of the buildx cache key so a moved upstream tip
# actually re-runs the install layer (otherwise gramps61 CI
# would stay on the same stale gramps revision build after
# build).
id: params
shell: bash
run: |
ref="${{ github.ref_name }}"
suffix="${ref#maintenance/}"
case "$suffix" in
gramps[0-9][0-9]) ;;
*) echo "::error::unexpected ref '$ref' (suffix '$suffix')"; exit 1 ;;
esac
# gramps60 → 6.0, gramps61 → 6.1, gramps62 → 6.2, …
series="${suffix:6:1}.${suffix:7}"
fallback_sha=$(git ls-remote https://github.com/gramps-project/gramps.git "refs/heads/maintenance/${suffix}" | awk '{print $1}')
if [ -z "$fallback_sha" ]; then
echo "::warning::upstream gramps-project/gramps has no maintenance/${suffix} branch; fallback path will fail if PyPI lacks gramps==${series}.*"
fi
echo "suffix=$suffix" >> "$GITHUB_OUTPUT"
echo "series=$series" >> "$GITHUB_OUTPUT"
echo "fallback_sha=$fallback_sha" >> "$GITHUB_OUTPUT"
- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.REPO }}/gramps-ci
tags: |
type=raw,value=${{ steps.params.outputs.suffix }}
type=sha,prefix=${{ steps.params.outputs.suffix }}-
- name: Build and push gramps-ci
uses: docker/build-push-action@v6
with:
context: .github/docker/gramps-ci
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
GRAMPS_SERIES=${{ steps.params.outputs.series }}
GRAMPS_FALLBACK_SHA=${{ steps.params.outputs.fallback_sha }}
cache-from: type=gha
cache-to: type=gha,mode=max