Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Replace local build cache with Github Registry (#10405)
Krzysztof Kwaśniak3ea923a86e86
diff --git a/.github/workflows/publish-containers.yml b/.github/workflows/publish-containers.ymlindex 7d2aae9e8a..1d8a4bbffe 100644--- a/.github/workflows/publish-containers.yml+++ b/.github/workflows/publish-containers.yml@@ -69,7 +69,7 @@ jobs:set -x# Version name is the branch name- # Slashes are substitued by dashes+ # Slashes are substituted by dashesCLEAN_BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)# Target GHCR with the branch name as the tag, e.g. unstable-main@@ -81,10 +81,23 @@ jobs:# <branch>-<drift>-g<6-digit-hash>NAMED_VERSION=$(git describe --all --long | tr -d $'\n')+ # setting version for cache-from+ IFS="." read -r -a VERSION_ARRAY <<< "$VERSION"+ if [ "${VERSION_ARRAY[-1]}" -gt 0 ]; then+ PREVIOUS_VERSION[-1]="$((${VERSION_ARRAY[-1]} - 1))"+ printf -v CACHE_FROM_VERSION "%s." "${PREVIOUS_VERSION[@]}"+ CACHE_FROM_VERSION="${CACHE_FROM_VERSION%.}"+ else+ # setting to unstable-main if patch is lower than 1 or is not+ # a digit+ CACHE_FROM_VERSION="unstable-main"+ fi+# Output the target tagsecho "CONTAINER_TAGS=${TAGS}NAMED_VERSION=${NAMED_VERSION}+ CACHE_FROM_VERSION=${CACHE_FROM_VERSION}" >> "${GITHUB_ENV}"- name: Set up QEMU@@ -96,14 +109,6 @@ jobs:id: buildxuses: docker/setup-buildx-action@v1- - name: Cache Docker layers- uses: actions/cache@v2- with:- path: /tmp/.buildx-cache- key: ${{ runner.os }}-buildx-${{ github.sha }}- restore-keys: |- ${{ runner.os }}-buildx-${{ hashFiles('requirements_dev.txt') }}-- name: Login to GitHub Container Registryuses: docker/login-action@v1with:@@ -120,8 +125,8 @@ jobs:platforms: linux/amd64,linux/arm64push: ${{ github.event_name != 'pull_request' }}tags: ${{ env.CONTAINER_TAGS }}- cache-from: type=local,src=/tmp/.buildx-cache- cache-to: type=local,dest=/tmp/.buildx-cache+ cache-from: type=registry,ref=saleor/saleor:${CACHE_FROM_VERSION}+ cache-to: type=registry,ref=saleor/saleor:${VERSION},mode=maxbuild-args: |PROJECT_VERSION=${{ env.NAMED_VERSION }}COMMIT_ID=${{ github.sha }}