diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 85d8d3f..cd0c379 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -7,13 +7,13 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Build - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile @@ -25,7 +25,7 @@ jobs: - name: Login to GitHub Container Registry if: startsWith(github.ref, 'refs/tags/') - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: docker.io username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -34,7 +34,7 @@ jobs: - name: Docker meta if: startsWith(github.ref, 'refs/tags/') id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: flavor: | latest=true @@ -46,7 +46,7 @@ jobs: - name: Tag and export if: startsWith(github.ref, 'refs/tags/') - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile @@ -56,3 +56,37 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + + - name: Login to GHCR + if: ${{ github.ref == 'refs/heads/main' }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Docker meta + if: startsWith(github.ref, 'refs/tags/') + id: meta-ghcr + uses: docker/metadata-action@v5 + with: + flavor: | + latest=true + images: | + ghcr.io/darkness4/katago + tags: | + type=ref,event=tag + type=sha + + - name: Build and export + if: startsWith(github.ref, 'refs/tags/') + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta-ghcr.outputs.tags }} + labels: ${{ steps.meta-ghcr.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max