name: Build and Push Docker Image on: workflow_dispatch: push: branches: - main env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }}/backend jobs: build-and-push: runs-on: [self-hosted] permissions: contents: read packages: write steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Buildx uses: docker/setup-buildx-action@v3 - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_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=sha,format=short type=ref,event=branch - name: Build and push Docker image (multi-arch) uses: docker/build-push-action@v6 with: context: ./frontend file: ./frontend/Dockerfile push: true platforms: linux/amd64,linux/arm64 tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - name: Notify updater (GET, bearer) if: ${{ success() && github.ref == 'refs/heads/main' }} env: WEBHOOK_TOKEN: ${{ secrets.GITHUB_WEBHOOK_TOKEN }} run: | curl -fsS --retry 5 -H "Authorization: Bearer ${WEBHOOK_TOKEN}" http://10.0.3.185:8080/v1/update