From 5e3fb8d6163e0758b99cfe39bcfc725939cac436 Mon Sep 17 00:00:00 2001 From: ggoknar Date: Mon, 30 Oct 2023 15:09:47 +0300 Subject: [PATCH] pr caching --- .github/workflows/build-and-push-to-ghcr.yml | 21 ++++++-------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-and-push-to-ghcr.yml b/.github/workflows/build-and-push-to-ghcr.yml index 2ebb585..bb143b1 100644 --- a/.github/workflows/build-and-push-to-ghcr.yml +++ b/.github/workflows/build-and-push-to-ghcr.yml @@ -13,15 +13,6 @@ jobs: name: Checkout uses: actions/checkout@v3 - - name: Set Release version - shell: bash - run: | - if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then - echo "RELEASE_VERSION=dev" >> $GITHUB_ENV - else - echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - fi - export TAG=${GHCR_URL}:${{ env.RELEASE_VERSION }}-${{ github.sha }} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -37,9 +28,9 @@ jobs: with: context: "{{defaultContext}}:server" file: Dockerfile - push: false - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache + push: false # Do not push image for PR + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-pr-${{ github.event.pull_request.head.sha }} tags: coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: @@ -49,9 +40,9 @@ jobs: with: context: "{{defaultContext}}:server" file: Dockerfile - push: false - cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache - cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:latest-cache + push: true # Push if merged + cache-from: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest + cache-to: type=registry,ref=ghcr.io/coqui-ai/xtts-streaming-server:cache-latest tags: coqui-ai/xtts-streaming-server:latest, coqui-ai/xtts-streaming-server:${{ env.RELEASE_VERSION }}-${{ github.sha }} #build-args: