@@ -3,10 +3,10 @@ name: Docker build
3
3
on :
4
4
workflow_dispatch :
5
5
push :
6
- branches : [ "master", "maint/*", "ci/gha-docker-build" ]
6
+ branches : [ "master", "main", " maint/*", "ci/gha-docker-build" ]
7
7
tags : " *"
8
8
pull_request :
9
- branches : [ "master" ]
9
+ branches : [ "master", "main", "maint/*" ]
10
10
11
11
env :
12
12
REGISTRY : ghcr.io
@@ -40,12 +40,18 @@ jobs:
40
40
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41
41
42
42
- name : Build and push Docker image
43
- id : build-and-push
44
43
uses : docker/build-push-action@v4
45
44
with :
46
45
context : .
47
46
push : ${{ github.event_name != 'pull_request' }}
48
47
tags : ${{ steps.meta.outputs.tags }}
49
48
labels : ${{ steps.meta.outputs.labels }}
50
- cache-from : type=registry,ref=${{ fromJSON(steps.meta.outputs.json).tags[0] }}
51
- cache-to : inline
49
+ cache-from : |
50
+ type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache
51
+ type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ env.TARGET_BRANCH }}
52
+ type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ github.ref_name }}
53
+ cache-to : |
54
+ type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache,mode=max
55
+ type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:cache-${{ github.ref_name }},mode=max
56
+ env :
57
+ TARGET_BRANCH : ${{ github.base_ref || github.ref_name }}
0 commit comments