name: Build and Push to GHCR on: push: branches: [main] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }}/cactoide jobs: build-and-push: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Log in to Container Registry uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile push: ${{ github.event_name != 'pull_request' }} cache-from: type=gha tags: latest cache-to: type=gha,mode=max platforms: linux/amd64,linux/arm64 - name: Output image info if: github.event_name != 'pull_request' run: | echo "Image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}"