From bc4015265ac1d25382016ef69fe9cae049918be2 Mon Sep 17 00:00:00 2001 From: deadprogram Date: Fri, 12 Jan 2024 15:00:48 +0100 Subject: [PATCH] build: use metadata and GH cache for all images Signed-off-by: deadprogram --- .github/workflows/docker.yml | 42 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8842678fe7..844350502a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -33,16 +33,6 @@ jobs: submodules: recursive - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - images: | - tinygo/tinygo-dev - ghcr.io/${{ github.repository_owner }}/tinygo-dev - tags: | - type=sha,format=long - type=raw,value=latest - name: Log in to Docker Hub uses: docker/login-action@v3 with: @@ -54,27 +44,43 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Docker meta for LLVM base image + id: metabase + uses: docker/metadata-action@v5 + with: + images: | + tinygo/llvm-17 + ghcr.io/${{ github.repository_owner }}/llvm-17 + tags: | + type=sha,format=long + type=raw,value=latest - name: Build and push LLVM base image uses: docker/build-push-action@v5 with: target: tinygo-llvm-build context: . push: true - tags: | - tinygo/llvm-17 - tinygo/llvm-17:latest - ghcr.io/tinygo-org/llvm-17 - ghcr.io/tinygo-org/llvm-17:latest - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.metabase.outputs.tags }} + labels: ${{ steps.metabase.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + - name: Docker meta for tinygo-dev + id: metadev + uses: docker/metadata-action@v5 + with: + images: | + tinygo/tinygo-dev + ghcr.io/${{ github.repository_owner }}/tinygo-dev + tags: | + type=sha,format=long + type=raw,value=latest - name: Build and push tinygo-dev image uses: docker/build-push-action@v5 with: context: . push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.metadev.outputs.tags }} + labels: ${{ steps.metadev.outputs.labels }} build-contexts: tinygo-llvm-build=docker-image://tinygo/llvm-17 cache-from: type=gha cache-to: type=gha,mode=max