fix CI not being allowed to push container image
All checks were successful
Build Container / Build Container (push) Successful in 40s

This commit is contained in:
lilly 2026-05-14 19:07:06 +02:00
commit 18b1d4f4cd
Signed by: lilly
SSH key fingerprint: SHA256:y9T5GFw2A20WVklhetIxG1+kcg/Ce0shnQmbu1LQ37g

View file

@ -4,9 +4,6 @@ on:
workflow_dispatch: {}
push: {}
permissions:
packages: write
jobs:
build-container:
name: Build Container
@ -14,24 +11,30 @@ jobs:
container:
image: ghcr.io/osscontainertools/kaniko:alpine
steps:
- name: Install NodeJS for actions compatibility
- name: Install required system packages
run: apk add --no-cache nodejs
- name: Checkout source code
uses: actions/checkout@v6
- name: Login to container registry (prod only)
if: ${{ forgejo.ref_name == 'main' }}
run: /kaniko/executor login --username="forgejo-actions" --password="${{ forgejo.token }}" git.hamburg.ccc.de
- name: Build Container
env:
KANIKO_NO_PUSH: ${{ forgejo.ref_name != 'main' }}
# env:
# KANIKO_NO_PUSH: ${{ forgejo.ref_name != 'main' }}
run: /kaniko/executor
--dockerfile="${{forgejo.workspace }}/Containerfile"
--context="dir://${{ forgejo.workspace }}"
--destination=git.hamburg.ccc.de/ccchh/dooris:latest
--credential-helpers=env
--tar-path=${{ forgejo.workspace }}/image.tar
--no-push
--no-push-cache
--annotation=org.opencontainers.image.ref.name=dooris
--annotation=org.opencontainers.image.url=${{ forgejo.server_url }}/${{ forgejo.repository }}
--annotation=org.opencontainers.image.source=${{ forgejo.server_url }}/${{ forgejo.repository }}
--annotation=org.opencontainers.image.licenses=AGPL-3.0
- name: Push Container (prod-only)
if: ${{ forgejo.ref_name == 'main' }}
run: |
apk add --no-cache skopeo
skopeo copy "docker-archive:${{ forgejo.workspace }}/image.tar" docker://git.hamburg.ccc.de/ccchh/dooris:latest --dest-creds="forgejo-actions:${{ secrets.PACKAGES_TOKEN }}"