Push the image to the forge registry as well

53dbc26 · Gabriel Morell · 2026-09-13 02:38

3 files +28 -0
Message
{commit_body(@commit)}

Files changed

modified .github/workflows/ci.yml
+28 −0
@@ -72,8 +72,35 @@ jobs:
72 72 - uses: actions/checkout@v4
73 73 - uses: docker/setup-buildx-action@v3
74 74
75 + # An unset CI_REGISTRY resolves to the empty string, and
76 + # login-action then silently defaults to docker.io while
77 + # metadata-action builds a nonsense "/owner/repo" reference. Say
78 + # what is missing instead.
79 + - name: Check the registry variable is set
80 + env:
81 + CI_REGISTRY: ${{ vars.CI_REGISTRY }}
82 + run: |
83 + set -euo pipefail
84 + if [ -z "${CI_REGISTRY:-}" ]; then
85 + echo "CI_REGISTRY is not set for this repository." >&2
86 + echo "Set it as an organisation-level Actions variable (the" >&2
87 + echo "registry hostname), the same one gitgud builds against." >&2
88 + exit 1
89 + fi
90 + echo "pushing to $CI_REGISTRY"
91 +
75 92 # GHCR uses the built-in token. Docker Hub and Quay creds come from
76 93 # org-wide secrets (DOCKERHUB_USER/DOCKERHUB_TOKEN, QUAY_USERNAME/QUAY_TOKEN).
94 + # The forge's own registry: no stored credential, the per-job token
95 + # is authorized to push this repository's own image path.
96 + - name: Log in to the forge registry
97 + if: github.event_name != 'pull_request'
98 + uses: docker/login-action@v3
99 + with:
100 + registry: ${{ vars.CI_REGISTRY }}
101 + username: ci
102 + password: ${{ github.token }}
103 +
77 104 - name: Log in to GHCR
78 105 if: github.event_name != 'pull_request'
79 106 uses: docker/login-action@v3
@@ -102,6 +129,7 @@ jobs:
102 129 uses: docker/metadata-action@v5
103 130 with:
104 131 images: |
132 + ${{ vars.CI_REGISTRY }}/${{ github.repository }}
105 133 ghcr.io/${{ github.repository }}
106 134 docker.io/neiam/feedpug
107 135 quay.io/neiam/feedpug

Parents: 270f6ce