Skip to content

Commit 62e4dc9

Browse files
IONOS(build): add cache versioning to improve cache management
Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
1 parent 15264d5 commit 62e4dc9

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

.github/workflows/build-artifact.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ env:
4141
REGISTRY: ghcr.io
4242
IMAGE_NAME: ${{ github.repository }}
4343
ARTIFACTORY_REPOSITORY_SNAPSHOT: ionos-productivity-ncwserver-snapshot
44+
# Cache version - increment this to invalidate all caches when build process changes
45+
# Update when: Node.js version changes, PHP version changes, build scripts modified, etc.
46+
# Format: v<major>.<minor> (e.g., v1.0, v1.1, v2.0)
47+
CACHE_VERSION: v1.0
4448

4549
permissions:
4650
contents: read
@@ -569,7 +573,8 @@ jobs:
569573
fi
570574
571575
# Cache key that would be used for this app
572-
CACHE_KEY="app-build-${APP_NAME}-${CURRENT_SHA}"
576+
# Format: <version>-app-build-<app-name>-<sha>
577+
CACHE_KEY="${{ env.CACHE_VERSION }}-app-build-${APP_NAME}-${CURRENT_SHA}"
573578
SHORT_SHA="${CURRENT_SHA:0:8}"
574579
575580
echo -n " Checking $APP_NAME (SHA: $SHORT_SHA)... "
@@ -731,7 +736,7 @@ jobs:
731736
uses: actions/cache/save@v4
732737
with:
733738
path: ${{ steps.app-config.outputs.path }}
734-
key: app-build-${{ matrix.app_info.name }}-${{ matrix.app_info.sha }}
739+
key: ${{ env.CACHE_VERSION }}-app-build-${{ matrix.app_info.name }}-${{ matrix.app_info.sha }}
735740

736741
- name: Upload ${{ matrix.app_info.name }} build artifacts
737742
uses: actions/upload-artifact@v4
@@ -797,7 +802,7 @@ jobs:
797802
uses: actions/cache/restore@v4
798803
with:
799804
path: ${{ matrix.app.path }}
800-
key: app-build-${{ matrix.app.name }}-${{ steps.get-sha.outputs.app-sha }}
805+
key: ${{ env.CACHE_VERSION }}-app-build-${{ matrix.app.name }}-${{ steps.get-sha.outputs.app-sha }}
801806
fail-on-cache-miss: true
802807

803808
- name: Validate cached build

0 commit comments

Comments
 (0)