diff --git a/.github/workflows/publish-ghcr.yml b/.github/workflows/publish-ghcr.yml new file mode 100644 index 0000000..948b1cc --- /dev/null +++ b/.github/workflows/publish-ghcr.yml @@ -0,0 +1,47 @@ +# Auto-generated by J1 pipeline (Phase 6). Publishes multi-service images to ghcr.io. +name: Publish images to GHCR +on: + push: + branches: [main, master] + tags: ['v*'] + workflow_dispatch: +env: + REGISTRY: ghcr.io +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + strategy: + matrix: + service: + - { name: "backend", context: "backend", dockerfile: "Dockerfile" } + - { name: "ffmpeg", context: "ffmpeg", dockerfile: "Dockerfile" } + - { name: "frontend", context: "frontend", dockerfile: "Dockerfile" } + steps: + - uses: actions/checkout@v4 + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ github.repository }}-${{ matrix.service.name }} + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=sha,format=short + type=raw,value=latest,enable={{is_default_branch}} + - uses: docker/setup-buildx-action@v3 + - uses: docker/build-push-action@v6 + with: + context: ${{ matrix.service.context }} + file: ${{ matrix.service.context }}/${{ matrix.service.dockerfile }} + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max