diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml index cba1b8c..2ca6570 100644 --- a/.github/workflows/build-image.yml +++ b/.github/workflows/build-image.yml @@ -7,7 +7,24 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + packages: write steps: - - uses: actions/checkout@v3 - - name: Build the Docker image - run: docker build . --tag papermc:$(date +%s) + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: ghcr.io/${{ github.repository }} + labels: org.opencontainers.image.source=https://github.com/${{ github.repository }} + cache-from: type=gha + cache-to: type=gha,mode=max