From da474f9a61506c814b3a47d6cc0721c08860a08a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Sat, 15 Nov 2025 17:14:25 +0100 Subject: [PATCH] feat: add Gitea Actions workflow for Docker build and push MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add workflow to build Docker image and push to Gitea container registry. - Registry: dev.pivoine.art - Image: valknar/sexy - Triggers on push to main/develop, tags, and manual dispatch - Builds linux/amd64 platform - Uses Gitea-specific context (gitea.actor, gitea.event, etc.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .gitea/workflows/docker-build-push.yml | 112 +++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 .gitea/workflows/docker-build-push.yml diff --git a/.gitea/workflows/docker-build-push.yml b/.gitea/workflows/docker-build-push.yml new file mode 100644 index 0000000..526a5d6 --- /dev/null +++ b/.gitea/workflows/docker-build-push.yml @@ -0,0 +1,112 @@ +name: Build and Push Docker Image to Gitea + +on: + push: + branches: + - main + - develop + tags: + - 'v*.*.*' + pull_request: + branches: + - main + workflow_dispatch: + inputs: + tag: + description: 'Custom tag for the image' + required: false + default: 'manual' + +env: + REGISTRY: dev.pivoine.art + IMAGE_NAME: valknar/sexy + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + platforms: linux/amd64 + + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ gitea.actor }} + password: ${{ secrets.GITEA_TOKEN }} + + - name: Extract metadata (tags, labels) + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + # Tag as 'latest' for main branch + type=raw,value=latest,enable={{is_default_branch}} + # Tag with branch name + type=ref,event=branch + # Tag with PR number + type=ref,event=pr + # Tag with git tag (semver) + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + # Tag with commit SHA + type=sha,prefix={{branch}}- + # Custom tag from workflow_dispatch + type=raw,value=${{ gitea.event.inputs.tag }},enable=${{ gitea.event_name == 'workflow_dispatch' }} + labels: | + org.opencontainers.image.title=sexy.pivoine.art + org.opencontainers.image.description=Adult content platform with SvelteKit, Directus, and hardware integration + org.opencontainers.image.vendor=valknar + org.opencontainers.image.source=https://dev.pivoine.art/${{ gitea.repository }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + platforms: linux/amd64 + push: ${{ gitea.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max + build-args: | + NODE_ENV=production + CI=true + + - name: Generate image digest + if: gitea.event_name != 'pull_request' + run: | + echo "### Docker Image Published :rocket:" >> $GITEA_STEP_SUMMARY + echo "" >> $GITEA_STEP_SUMMARY + echo "**Registry:** \`${{ env.REGISTRY }}\`" >> $GITEA_STEP_SUMMARY + echo "**Image:** \`${{ env.IMAGE_NAME }}\`" >> $GITEA_STEP_SUMMARY + echo "" >> $GITEA_STEP_SUMMARY + echo "**Tags:**" >> $GITEA_STEP_SUMMARY + echo "\`\`\`" >> $GITEA_STEP_SUMMARY + echo "${{ steps.meta.outputs.tags }}" >> $GITEA_STEP_SUMMARY + echo "\`\`\`" >> $GITEA_STEP_SUMMARY + echo "" >> $GITEA_STEP_SUMMARY + echo "**Pull command:**" >> $GITEA_STEP_SUMMARY + echo "\`\`\`bash" >> $GITEA_STEP_SUMMARY + echo "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITEA_STEP_SUMMARY + echo "\`\`\`" >> $GITEA_STEP_SUMMARY + + - name: PR Comment - Image built but not pushed + if: gitea.event_name == 'pull_request' + run: | + echo "### Docker Image Built Successfully :white_check_mark:" >> $GITEA_STEP_SUMMARY + echo "" >> $GITEA_STEP_SUMMARY + echo "Image was built successfully but **not pushed** (PR builds are not published)." >> $GITEA_STEP_SUMMARY + echo "" >> $GITEA_STEP_SUMMARY + echo "**Would be tagged as:**" >> $GITEA_STEP_SUMMARY + echo "\`\`\`" >> $GITEA_STEP_SUMMARY + echo "${{ steps.meta.outputs.tags }}" >> $GITEA_STEP_SUMMARY + echo "\`\`\`" >> $GITEA_STEP_SUMMARY