diff --git a/.github/workflows/publish.yml b/.github/workflows/docker-publish.yml similarity index 55% rename from .github/workflows/publish.yml rename to .github/workflows/docker-publish.yml index 5c52e5c..cf6158d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,59 +1,77 @@ -name: Publish image +name: Build and Publish Docker Image -# Build and push the feeder image to the GitHub Container Registry (ghcr.io): -# * every push to main -> the moving `main` tag -# * every `v*` tag -> semver tags (e.g. v1.0.0 -> 1.0.0, 1.0, 1) -# The build context is the repo root (the workspace) so the vendored -# `meta-feeder-sdk` path dependency resolves; the Dockerfile lives under -# feeder-plugin/torrent-feeder/. on: push: - branches: [main] - tags: ['v*'] + branches: + - main + tags: + - 'v*' + pull_request: + branches: + - main + workflow_dispatch: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: - publish: + build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write + steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v4 + - name: Free disk space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Log in to GitHub Container Registry + - name: Log in to Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract image metadata + - name: Extract metadata (tags, labels) id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch + type=ref,event=pr + type=sha type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=semver,pattern={{major}} - type=sha,format=short + type=raw,value=latest,enable={{is_default_branch}} - - name: Build and push + - name: Build and push Docker image uses: docker/build-push-action@v6 with: context: . - file: ./feeder-plugin/torrent-feeder/Dockerfile + platforms: linux/amd64,linux/arm64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + provenance: false cache-from: type=gha cache-to: type=gha,mode=max