Images: ghcr.io from GitHub, the forge registry from .forgejo

5b60078 · Gabe Morell · 2026-10-27 02:21

6 files +55 -0
Message
{commit_body(@commit)}

Files changed

added .forgejo/workflows/image.yml
+51 −0
@@ -0,0 +1,51 @@
1 +# The forge's copy of the image publish. .github/workflows/
2 +# docker-build-push.yml pushes to ghcr.io, but only when it runs on
3 +# GitHub; here the image goes to the forge's bundled registry
4 +# (CI_REGISTRY), as camerite and gitgud do: <registry>/<owner>/<repo>,
5 +# tagged with the full commit sha and :latest like the ghcr.io one.
6 +#
7 +# No secrets. The forge injects CI_REGISTRY and accepts the per-job
8 +# github.token for push to this repository's own image path.
9 +name: image
10 +
11 +on:
12 + push:
13 + branches: [master]
14 + workflow_dispatch:
15 +
16 +jobs:
17 + image:
18 + if: github.server_url != 'https://github.com'
19 + runs-on: ubuntu-latest
20 + permissions:
21 + contents: read
22 + packages: write
23 + steps:
24 + - uses: actions/checkout@v4
25 + - uses: docker/setup-buildx-action@v3
26 +
27 + # The username is ignored by the token endpoint, but login-action
28 + # requires it to be non-empty.
29 + - name: Log in to the forge registry
30 + uses: docker/login-action@v3
31 + with:
32 + registry: ${{ vars.CI_REGISTRY }}
33 + username: gitgud-actions
34 + password: ${{ github.token }}
35 +
36 + - id: meta
37 + uses: docker/metadata-action@v5
38 + with:
39 + images: ${{ vars.CI_REGISTRY }}/${{ github.repository }}
40 + tags: |
41 + type=raw,value=${{ github.sha }}
42 + type=raw,value=latest,enable={{is_default_branch}}
43 +
44 + - uses: docker/build-push-action@v6
45 + with:
46 + context: .
47 + push: true
48 + tags: ${{ steps.meta.outputs.tags }}
49 + labels: ${{ steps.meta.outputs.labels }}
50 + cache-from: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache
51 + cache-to: type=registry,ref=${{ vars.CI_REGISTRY }}/${{ github.repository }}:buildcache,mode=max
modified .github/workflows/docker-build-push.yml
+4 −0
@@ -10,7 +10,11 @@ env:
10 10 IMAGE_NAME: neiam/mutant-operator
11 11
12 12 jobs:
13 + # ghcr.io from GitHub only. The forge reads .github/workflows too, and
14 + # there the ghcr.io login 403s; .forgejo/workflows/image.yml publishes
15 + # to the forge's own registry instead.
13 16 build-and-push:
17 + if: github.server_url == 'https://github.com'
14 18 runs-on: ubuntu-latest
15 19 permissions:
16 20 contents: read

Parents: 5e1da31