Skip to content

Commit fb60493

Browse files
ci: publish selur and vordr images to GHCR (#116)
## What Adds `.github/workflows/publish-image.yml` — a matrix workflow that builds and pushes the **selur** and **vordr** container images to `ghcr.io/hyperpolymath/<service>` on push to `main` (and via `workflow_dispatch`). ## Why Part of a cross-repo cleanup of mis-attributed GHCR packages. `odds-and-sods-package-manager` (OPSM) used to build these images, so `docker/metadata-action` stamped `org.opencontainers.image.source` with OPSM and GitHub linked the `selur`/`vordr` packages to the wrong repo. Publishing them from **stapeln** (their real home) re-points each package's "Repository source" to `hyperpolymath/stapeln` on the next push. ## Details - Matrix builds only `selur` and `vordr`. **cerro-torre** stays unpublished (source kept here only) and **svalinn** self-publishes from `hyperpolymath/svalinn`, so neither is in the matrix. - Each service builds from its own dir context (`container-stack/<service>`, `file: container-stack/<service>/Containerfile`) — exactly how `container-stack-smoke.yml` already builds them, so the Containerfiles are known-good. - Actions are SHA-pinned to the estate policy (same pins used elsewhere in the org), `permissions` are least-privilege (`packages: write` only on the build job), and build provenance is attested via `actions/attest-build-provenance`. > Note: the GHCR package → repo **re-link** itself is a manual one-time step in the GitHub package settings UI (unlink old source / connect this repo); this workflow ensures every subsequent push publishes with the correct source label. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_012kWck3NjBo5orHKAXMHm5W --- _Generated by [Claude Code](https://claude.ai/code/session_012kWck3NjBo5orHKAXMHm5W)_ Co-authored-by: Claude <noreply@anthropic.com>
1 parent fd9da47 commit fb60493

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# SPDX-License-Identifier: MPL-2.0
2+
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
#
4+
# Publish stapeln's container images (selur, vordr) to GHCR so that each
5+
# GHCR package links back to hyperpolymath/stapeln via the
6+
# org.opencontainers.image.source label injected by docker/metadata-action.
7+
#
8+
# cerro-torre and svalinn are intentionally NOT published here:
9+
# - cerro-torre stays unpublished (source kept in this repo only)
10+
# - svalinn publishes its own image from hyperpolymath/svalinn
11+
name: Publish Image
12+
on:
13+
push:
14+
branches: [main]
15+
paths:
16+
- 'container-stack/selur/**'
17+
- 'container-stack/vordr/**'
18+
- '.github/workflows/publish-image.yml'
19+
workflow_dispatch: {}
20+
permissions:
21+
contents: read
22+
jobs:
23+
build-push:
24+
name: Build ${{ matrix.service }}
25+
runs-on: ubuntu-latest
26+
timeout-minutes: 20
27+
permissions:
28+
contents: read
29+
packages: write
30+
id-token: write
31+
attestations: write
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
service: [selur, vordr]
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
39+
- name: Set up Docker Buildx
40+
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
41+
- name: Log in to GHCR
42+
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v3
43+
with:
44+
registry: ghcr.io
45+
username: ${{ github.actor }}
46+
password: ${{ secrets.GITHUB_TOKEN }}
47+
- name: Extract metadata
48+
id: meta
49+
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
50+
with:
51+
images: ghcr.io/hyperpolymath/${{ matrix.service }}
52+
tags: |
53+
type=raw,value=latest,enable={{is_default_branch}}
54+
type=sha
55+
- name: Build and push ${{ matrix.service }}
56+
id: push
57+
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v6
58+
with:
59+
context: container-stack/${{ matrix.service }}
60+
file: container-stack/${{ matrix.service }}/Containerfile
61+
push: true
62+
tags: ${{ steps.meta.outputs.tags }}
63+
labels: ${{ steps.meta.outputs.labels }}
64+
cache-from: type=gha,scope=${{ matrix.service }}
65+
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
66+
- name: Attest container provenance
67+
uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2
68+
with:
69+
subject-name: ghcr.io/hyperpolymath/${{ matrix.service }}
70+
subject-digest: ${{ steps.push.outputs.digest }}
71+
push-to-registry: true

0 commit comments

Comments
 (0)