Skip to content

Commit cc5bad4

Browse files
committed
fix: cd_builderキャッシュ戦略改善
1 parent 74398ec commit cc5bad4

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

.github/workflows/cd_builder.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ jobs:
2525
uses: docker/setup-buildx-action@v3
2626

2727
- name: Log in to GitHub Container Registry
28+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
2829
uses: docker/login-action@v3
2930
with:
3031
registry: ${{ env.REGISTRY }}
@@ -51,8 +52,14 @@ jobs:
5152
push: true
5253
tags: ${{ steps.meta.outputs.tags }}
5354
labels: ${{ steps.meta.outputs.labels }}
54-
cache-from: type=gha,scope=cd-builder
55-
cache-to: type=gha,mode=max,scope=cd-builder
55+
cache-from: |
56+
type=gha,scope=cd-builder-${{ github.head_ref || github.ref_name }}
57+
type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
58+
type=gha,scope=cd-builder-develop
59+
type=gha,scope=cd-builder-main
60+
cache-to: |
61+
type=gha,mode=max,scope=cd-builder-${{ github.head_ref || github.ref_name }}
62+
${{ (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop') && format('type=registry,ref=ghcr.io/{0}:buildcache,mode=max', github.repository) || '' }}
5663
5764
- name: Generate artifact attestation
5865
uses: actions/attest-build-provenance@v3

0 commit comments

Comments
 (0)