From 73f7a4f2f072f14ad346f9a32c31d97e519eda2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Kr=C3=BCger?= Date: Wed, 4 Mar 2026 19:05:54 +0100 Subject: [PATCH] ci: replace combined workflow with separate frontend and backend workflow files Co-Authored-By: Claude Sonnet 4.6 --- .gitea/workflows/docker-build-backend.yml | 60 ++++++++ .gitea/workflows/docker-build-frontend.yml | 60 ++++++++ .gitea/workflows/docker-build-push.yml | 151 --------------------- 3 files changed, 120 insertions(+), 151 deletions(-) create mode 100644 .gitea/workflows/docker-build-backend.yml create mode 100644 .gitea/workflows/docker-build-frontend.yml delete mode 100644 .gitea/workflows/docker-build-push.yml diff --git a/.gitea/workflows/docker-build-backend.yml b/.gitea/workflows/docker-build-backend.yml new file mode 100644 index 0000000..1dbdcbe --- /dev/null +++ b/.gitea/workflows/docker-build-backend.yml @@ -0,0 +1,60 @@ +name: Build and Push Backend Image + +on: + push: + branches: + - main + - develop + tags: + - 'v*.*.*' + pull_request: + branches: + - main + workflow_dispatch: + +env: + REGISTRY: dev.pivoine.art + IMAGE_NAME: valknar/sexy-backend + +jobs: + build: + 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.REGISTRY_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=sha,prefix={{branch}}- + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + dockerfile: Dockerfile.backend + platforms: linux/amd64 + push: ${{ gitea.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max diff --git a/.gitea/workflows/docker-build-frontend.yml b/.gitea/workflows/docker-build-frontend.yml new file mode 100644 index 0000000..c18049d --- /dev/null +++ b/.gitea/workflows/docker-build-frontend.yml @@ -0,0 +1,60 @@ +name: Build and Push Frontend Image + +on: + push: + branches: + - main + - develop + tags: + - 'v*.*.*' + pull_request: + branches: + - main + workflow_dispatch: + +env: + REGISTRY: dev.pivoine.art + IMAGE_NAME: valknar/sexy + +jobs: + build: + 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.REGISTRY_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=raw,value=latest,enable={{is_default_branch}} + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=sha,prefix={{branch}}- + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + dockerfile: Dockerfile + platforms: linux/amd64 + push: ${{ gitea.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max diff --git a/.gitea/workflows/docker-build-push.yml b/.gitea/workflows/docker-build-push.yml deleted file mode 100644 index e73ad14..0000000 --- a/.gitea/workflows/docker-build-push.yml +++ /dev/null @@ -1,151 +0,0 @@ -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 - BACKEND_IMAGE_NAME: valknar/sexy-backend - -jobs: - build-frontend: - 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.REGISTRY_TOKEN }} - - - name: Extract metadata (tags, labels) - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,prefix={{branch}}- - 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 frontend (SvelteKit) - org.opencontainers.image.vendor=valknar - org.opencontainers.image.source=https://dev.pivoine.art/${{ gitea.repository }} - - - name: Build and push frontend Docker image - uses: docker/build-push-action@v5 - with: - context: . - dockerfile: Dockerfile - platforms: linux/amd64 - push: ${{ gitea.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache - cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max - build-args: | - NODE_ENV=production - CI=true - - - name: Generate image digest - if: gitea.event_name != 'pull_request' - run: | - echo "### Frontend Image Published :rocket:" >> $GITEA_STEP_SUMMARY - echo "" >> $GITEA_STEP_SUMMARY - echo "**Registry:** \`${{ env.REGISTRY }}\`" >> $GITEA_STEP_SUMMARY - echo "\`\`\`" >> $GITEA_STEP_SUMMARY - echo "${{ steps.meta.outputs.tags }}" >> $GITEA_STEP_SUMMARY - echo "\`\`\`" >> $GITEA_STEP_SUMMARY - - build-backend: - 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.REGISTRY_TOKEN }} - - - name: Extract metadata for backend image - id: meta-backend - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }} - tags: | - type=raw,value=latest,enable={{is_default_branch}} - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} - type=semver,pattern={{major}} - type=sha,prefix={{branch}}- - type=raw,value=${{ gitea.event.inputs.tag }},enable=${{ gitea.event_name == 'workflow_dispatch' }} - labels: | - org.opencontainers.image.title=sexy.pivoine.art backend - org.opencontainers.image.description=GraphQL backend for sexy.pivoine.art (Fastify + Drizzle + Pothos) - org.opencontainers.image.vendor=valknar - org.opencontainers.image.source=https://dev.pivoine.art/${{ gitea.repository }} - - - name: Build and push backend Docker image - uses: docker/build-push-action@v5 - with: - context: . - dockerfile: Dockerfile.backend - platforms: linux/amd64 - push: ${{ gitea.event_name != 'pull_request' }} - tags: ${{ steps.meta-backend.outputs.tags }} - labels: ${{ steps.meta-backend.outputs.labels }} - no-cache: true - build-args: | - NODE_ENV=production - CI=true - - - name: Generate image digest - if: gitea.event_name != 'pull_request' - run: | - echo "### Backend Image Published :rocket:" >> $GITEA_STEP_SUMMARY - echo "" >> $GITEA_STEP_SUMMARY - echo "**Registry:** \`${{ env.REGISTRY }}\`" >> $GITEA_STEP_SUMMARY - echo "\`\`\`" >> $GITEA_STEP_SUMMARY - echo "${{ steps.meta-backend.outputs.tags }}" >> $GITEA_STEP_SUMMARY - echo "\`\`\`" >> $GITEA_STEP_SUMMARY