diff --git a/.github/workflows/image.yml b/.github/workflows/image.yml index a0e2c36..818e773 100644 --- a/.github/workflows/image.yml +++ b/.github/workflows/image.yml @@ -4,9 +4,16 @@ on: push: branches: main +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: - build: + build-and-push-image: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Check out the repo @@ -26,16 +33,23 @@ jobs: - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/debridmediamanager/zurg:latest + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache