From 6ba8ea3f10794a356bc5e35c6e24efd93fc17a68 Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Wed, 10 Jul 2024 15:05:42 -0400 Subject: [PATCH] More fixed to caching and general build --- .github/workflows/docker_publish.yml | 29 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker_publish.yml b/.github/workflows/docker_publish.yml index 784740552..36ec06f74 100644 --- a/.github/workflows/docker_publish.yml +++ b/.github/workflows/docker_publish.yml @@ -29,7 +29,9 @@ jobs: - name: Display the version of go that we have installed run: go version - - uses: actions/cache@v4 + - name: Restore cached Go build & dependencies + id: cache-restore + uses: actions/cache/restore@v4 with: path: | ~/.cache/go-build @@ -37,26 +39,21 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - save-always: true - name: Compile the binary run: | - # Ensure we get something to describe.... - git fetch --tags - make install - mkdir /root/build - cp "`go env GOPATH`/bin/seid" /root/build/seid + cp "`go env GOPATH`/bin/seid" ./ - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -78,7 +75,17 @@ jobs: uses: docker/build-push-action@v4 with: file: Dockerfile.sf - context: /root/build + context: . push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + - name: Always Save Go build & dependencies + id: cache-save + if: always() && steps.cache-restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} \ No newline at end of file