diff --git a/.github/workflows/docker-latest.yml b/.github/workflows/docker-latest.yml index 18c69a1..20f4cf5 100644 --- a/.github/workflows/docker-latest.yml +++ b/.github/workflows/docker-latest.yml @@ -24,32 +24,27 @@ jobs: - name: Run tests run: npm run test - pushToGHCR: - needs: runTests + docker: runs-on: ubuntu-latest steps: - - - uses: actions/checkout@v3 - - - name: Log in to the Container registry - uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build Docker image - env: - VERSION: ${{ github.sha }} - IMAGE: ghcr.io/evanp/onepage.pub - run: | - docker build -t $IMAGE:$VERSION . - docker tag $IMAGE:$VERSION $IMAGE:latest - - - name: Push Docker image - env: - VERSION: ${{ github.sha }} - IMAGE: ghcr.io/evanp/onepage.pub - run: | - docker push $IMAGE:$VERSION - docker push $IMAGE:latest + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + 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: + context: . + push: true + tags: ghcr.io/evanp/onepage.pub:latest + cache-from: type=registry,ref=ghcr.io/evanp/onepage.pub:latest + cache-to: type=inline