Skip to content

Commit 4ff4b0a

Browse files
Merge pull request #141 from Impre-visible/test/workflow
test: update workflow scope for better caching
2 parents bcb5676 + f169757 commit 4ff4b0a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/docker-publish.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ jobs:
4040
echo "IMAGE_TAGS=ghcr.io/${REPO_NAME_LOWER}:latest" >> $GITHUB_ENV
4141
fi
4242
43+
- name: Set CACHE_REF based on Git ref
44+
run: |
45+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
46+
echo "CACHE_REF=release" >> $GITHUB_ENV
47+
else
48+
# Extrait le nom de la branche
49+
echo "CACHE_REF=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
50+
fi
51+
4352
- name: Extract metadata
4453
id: meta
4554
uses: docker/metadata-action@v5
@@ -71,5 +80,5 @@ jobs:
7180
tags: ${{ env.IMAGE_TAGS }}
7281
labels: ${{ steps.meta.outputs.labels }}
7382
platforms: linux/amd64,linux/arm64
74-
cache-from: type=gha,scope=repository,mode=max
75-
cache-to: type=gha,mode=max,scope=repository
83+
cache-from: type=gha,mode=max,scope=${{ env.CACHE_REF }}
84+
cache-to: type=gha,mode=max,scope=${{ env.CACHE_REF }}

0 commit comments

Comments
 (0)