diff --git a/.gitea/workflows/build-platform-api.yaml b/.gitea/workflows/build-platform-api.yaml new file mode 100644 index 0000000..0a5e021 --- /dev/null +++ b/.gitea/workflows/build-platform-api.yaml @@ -0,0 +1,66 @@ +name: Build & Push Platform API + +on: + push: + paths: + - 'services/platform-api/**' + branches: [main] + workflow_dispatch: + +env: + REGISTRY: gitea.platform.dlytica.com + IMAGE: gitea_admin/platform-api + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx (BuildKit) + uses: docker/setup-buildx-action@v3 + with: + # Use the BuildKit daemon deployed in the cluster as a remote builder + # Falls back to the local BuildKit instance in the runner environment + driver: docker-container + driver-opts: | + image=moby/buildkit:latest + network=host + + - name: Login to Gitea Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: gitea_admin + password: ${{ secrets.GITEA_REGISTRY_PASSWORD }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE }} + tags: | + type=sha,prefix=sha-,format=short + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: services/platform-api + file: services/platform-api/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE }}:buildcache,mode=max + provenance: false + sbom: false + + - name: Rollout restart + if: success() + run: | + curl -s -X POST \ + -H "Authorization: token ${{ secrets.GITEA_REGISTRY_PASSWORD }}" \ + "${{ env.REGISTRY }}/api/v1/repos/gitea_admin/platform-api/tags" || true + echo "Image pushed: ${{ steps.meta.outputs.tags }}"