From 84094841446779aab779a3bf9f2f6b313849805d Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Sun, 1 Jan 2023 12:03:27 +0100 Subject: [PATCH] update GHA workflow --- .github/workflows/master-latest.yml | 32 ++++++++--------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/.github/workflows/master-latest.yml b/.github/workflows/master-latest.yml index 8a60183..af14d28 100644 --- a/.github/workflows/master-latest.yml +++ b/.github/workflows/master-latest.yml @@ -10,36 +10,22 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 # We use buildx instead of regular build so we can take advantage of Docker layer cache via GithubActions' cache - name: Set up Docker Buildx id: buildx - uses: docker/setup-buildx-action@v1 - - # Setup the Github Actions cache. - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildxarch-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildxarch- + uses: docker/setup-buildx-action@v2 - name: Docker Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v2 with: registry: ghcr.io - username: ${{ github.repository_owner }} # github username or org - password: ${{ secrets.GITHUB_TOKEN }} # github actions builtin token. repo has to have pkg access. - - - name: Prepare - id: prep - run: | - echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ') + username: ${{ github.repository_owner }} # GitHub username or org + password: ${{ secrets.GITHUB_TOKEN }} # GitHub actions builtin token. repo has to have pkg access. - name: Build and push id: docker_build @@ -48,6 +34,7 @@ jobs: context: . file: ./Dockerfile platforms: linux/amd64,linux/arm64 + pull: true push: true tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest,ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }} labels: | @@ -55,9 +42,8 @@ jobs: org.opencontainers.image.description=${{ github.event.repository.description }} org.opencontainers.image.url=${{ github.event.repository.html_url }} org.opencontainers.image.source=${{ github.event.repository.clone_url }} - org.opencontainers.image.created=${{ steps.prep.outputs.created }} org.opencontainers.image.revision=${{ github.sha }} org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }} - cache-from: type=local,src=/tmp/.buildx-cache/release - cache-to: type=local,mode=max,dest=/tmp/.buildx-cache/release + cache-from: type=gha # all-automatic GitHub Actions caching + cache-to: type=gha,mode=max