File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -42,14 +42,25 @@ jobs:
42
42
if : env.CACHE_HIT == 'true'
43
43
shell : pwsh
44
44
run : |
45
- docker build --cache-from app:latest -f docker/mount.dockerfile -t app:latest .
45
+ New-Item -Path build.log -ItemType File -Force
46
+ docker build --cache-from app:latest --progress=plain -f docker/mount.dockerfile -t app:latest . | Tee-Object -FilePath build.log
47
+ $total_steps = (Get-Content build.log | Select-String -Pattern '^Step [0-9]+/' | Measure-Object).Count
48
+ $cache_hits = (Get-Content build.log | Select-String -Pattern '---> Using cache' | Measure-Object).Count
49
+ if ($cache_hits -eq $total_steps) {
50
+ echo "FULL_CACHE_HIT=true" >> $env:GITHUB_ENV
51
+ Write-Host "Full cache hit, all layers were used from source cache."
52
+ } else {
53
+ Write-Host "Partial cache hit, some layers were rebuilt."
54
+ }
46
55
47
56
- name : Save Docker Image to TAR
57
+ if : env.FULL_CACHE_HIT != 'true'
48
58
shell : pwsh
49
59
run : |
50
60
docker save -o cache-image.tar app:latest
51
-
61
+
52
62
- name : Cache Image TAR
63
+ if : env.FULL_CACHE_HIT != 'true'
53
64
uses : actions/cache@v4
54
65
with :
55
66
path : cache-image.tar
You can’t perform that action at this time.
0 commit comments