From 65b7f84dbe94aa79a272b23046ec9e6ca3b1ad78 Mon Sep 17 00:00:00 2001 From: Tibo De Peuter Date: Tue, 18 Aug 2026 18:41:44 +0200 Subject: [PATCH] ci(forgejo): configure act-runner container, registry host, and token fallback --- .forgejo/workflows/build-push.yml | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/.forgejo/workflows/build-push.yml b/.forgejo/workflows/build-push.yml index 3ee1c48..983a1e4 100644 --- a/.forgejo/workflows/build-push.yml +++ b/.forgejo/workflows/build-push.yml @@ -9,28 +9,43 @@ on: tags: - 'v*' +permissions: + contents: write + packages: write + jobs: build-and-push: runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + permissions: + contents: write + packages: write steps: - name: Checkout Repository uses: actions/checkout@v4 + - name: Extract Registry Host + id: reg + run: | + SERVER_HOST=$(echo "${{ gitea.server_url }}" | sed -e 's|^https\?://||') + echo "host=${SERVER_HOST}" >> "$GITHUB_OUTPUT" + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Forgejo Container Registry uses: docker/login-action@v3 with: - registry: ${{ gitea.server_url }} + registry: ${{ steps.reg.outputs.host }} username: ${{ gitea.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + password: ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }} - name: Extract Metadata for Docker id: meta uses: docker/metadata-action@v5 with: - images: ${{ gitea.server_url }}/${{ gitea.repository }} + images: ${{ steps.reg.outputs.host }}/${{ gitea.repository }} tags: | type=raw,value=latest,enable=${{ gitea.ref == 'refs/heads/main' || gitea.ref == 'refs/heads/master' }} type=ref,event=branch @@ -44,13 +59,16 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + provenance: false create-release: needs: build-and-push if: (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + permissions: + contents: write steps: - name: Checkout Repository uses: actions/checkout@v4 @@ -68,7 +86,7 @@ jobs: echo "Creating release ${RELEASE_NAME} with tag ${TAG_NAME}..." curl -s -X POST "${{ gitea.server_url }}/api/v1/repos/${{ gitea.repository }}/releases" \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Authorization: token ${{ secrets.REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}" \ -H "Content-Type: application/json" \ -d "{ \"tag_name\": \"${TAG_NAME}\",