Skip to content

Commit cc25b77

Browse files
hyperpolymathclaude
andcommitted
fix(ci): replace docker actions with native Podman in container-publish.yml
docker/login-action and docker/build-push-action replaced with podman login / podman build / podman push shell steps (Podman is pre-installed on ubuntu-latest). DockerHub push now conditional via a credential-check step rather than expression-level secret access. SPDX header and OCI license label updated from MPL-2.0 to PMPL-1.0-or-later. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0288218 commit cc25b77

1 file changed

Lines changed: 57 additions & 33 deletions

File tree

Lines changed: 57 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# SPDX-License-Identifier: MPL-2.0
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
33
#
44
# Container Publish workflow — builds and pushes the container image to
5-
# GitHub Container Registry (ghcr.io) and Docker Hub on version tag push
6-
# (v*) or manual dispatch. Uses the multi-stage Containerfile in container/.
5+
# GitHub Container Registry (ghcr.io) and optionally Docker Hub on version
6+
# tag push (v*) or manual dispatch. Uses Podman + the multi-stage
7+
# Containerfile in container/.
78
name: Container Publish
89

910
on:
@@ -24,41 +25,64 @@ jobs:
2425
steps:
2526
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2627

28+
- name: Extract version metadata
29+
id: meta
30+
run: |
31+
VERSION="${GITHUB_REF_NAME#v}"
32+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
33+
echo "image=ghcr.io/${{ github.repository }}" >> "$GITHUB_OUTPUT"
34+
35+
- name: Check Docker Hub credentials
36+
id: dockerhub
37+
env:
38+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
39+
run: |
40+
if [ -n "$DOCKERHUB_USERNAME" ]; then
41+
echo "available=true" >> "$GITHUB_OUTPUT"
42+
else
43+
echo "available=false" >> "$GITHUB_OUTPUT"
44+
fi
45+
2746
- name: Log in to GitHub Container Registry
28-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
29-
with:
30-
registry: ghcr.io
31-
username: ${{ github.actor }}
32-
password: ${{ secrets.GITHUB_TOKEN }}
47+
run: |
48+
echo "${{ secrets.GITHUB_TOKEN }}" | \
49+
podman login ghcr.io -u "${{ github.actor }}" --password-stdin
3350
3451
- name: Log in to Docker Hub
35-
if: env.DOCKERHUB_USERNAME != ''
36-
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
52+
if: steps.dockerhub.outputs.available == 'true'
3753
env:
3854
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
39-
with:
40-
username: ${{ secrets.DOCKERHUB_USERNAME }}
41-
password: ${{ secrets.DOCKERHUB_TOKEN }}
55+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
56+
run: |
57+
echo "$DOCKERHUB_TOKEN" | \
58+
podman login docker.io -u "$DOCKERHUB_USERNAME" --password-stdin
4259
43-
- name: Extract version metadata
44-
id: meta
60+
- name: Build container image
4561
run: |
46-
VERSION="${GITHUB_REF_NAME#v}"
47-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
62+
podman build \
63+
--file container/Containerfile \
64+
--tag "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}" \
65+
--tag "${{ steps.meta.outputs.image }}:latest" \
66+
--label "org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}" \
67+
--label "org.opencontainers.image.description=Bundle of Joy MCP Server — 99 formally verified cartridges" \
68+
--label "org.opencontainers.image.licenses=PMPL-1.0-or-later" \
69+
--label "org.opencontainers.image.version=${{ steps.meta.outputs.version }}" \
70+
.
4871
49-
- name: Build and push container image
50-
uses: docker/build-push-action@471d1dc4e07e5cdedd4c2171150001c434f0b7a4 # v6.15.0
51-
with:
52-
context: .
53-
file: container/Containerfile
54-
push: true
55-
tags: |
56-
ghcr.io/${{ github.repository }}:${{ steps.meta.outputs.version }}
57-
ghcr.io/${{ github.repository }}:latest
58-
${{ secrets.DOCKERHUB_USERNAME && format('docker.io/{0}/boj-server:{1}', secrets.DOCKERHUB_USERNAME, steps.meta.outputs.version) || '' }}
59-
${{ secrets.DOCKERHUB_USERNAME && format('docker.io/{0}/boj-server:latest', secrets.DOCKERHUB_USERNAME) || '' }}
60-
labels: |
61-
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
62-
org.opencontainers.image.description=Bundle of Joy MCP Server — 99 formally verified cartridges
63-
org.opencontainers.image.licenses=MPL-2.0
64-
org.opencontainers.image.version=${{ steps.meta.outputs.version }}
72+
- name: Push to GitHub Container Registry
73+
run: |
74+
podman push "${{ steps.meta.outputs.image }}:${{ steps.meta.outputs.version }}"
75+
podman push "${{ steps.meta.outputs.image }}:latest"
76+
77+
- name: Tag and push to Docker Hub
78+
if: steps.dockerhub.outputs.available == 'true'
79+
env:
80+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
81+
run: |
82+
VERSION="${{ steps.meta.outputs.version }}"
83+
SRC="${{ steps.meta.outputs.image }}"
84+
DST="docker.io/$DOCKERHUB_USERNAME/boj-server"
85+
podman tag "$SRC:$VERSION" "$DST:$VERSION"
86+
podman tag "$SRC:latest" "$DST:latest"
87+
podman push "$DST:$VERSION"
88+
podman push "$DST:latest"

0 commit comments

Comments
 (0)