3737 id : buildx
3838 uses : docker/setup-buildx-action@v3
3939
40+ - name : Cache Docker layers
41+ uses : actions/cache@v4
42+ with :
43+ path : /tmp/.buildx-cache
44+ key : ${{ runner.os }}-buildx-${{ github.sha }}
45+ restore-keys : |
46+ ${{ runner.os }}-buildx-
47+
4048 - name : Check out repo
4149 id : checkout
4250 uses : actions/checkout@v4
7583 ghcr.io/${{ github.repository }}:latest
7684 ghcr.io/${{ github.repository }}:${{ env.BUILD_BRANCH }}
7785 ghcr.io/${{ github.repository }}:${{ env.BUILD_VER }}
86+ cache-from : type=local,src=/tmp/.buildx-cache
87+ cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
88+
89+ - name : Move cache
90+ if : ${{ env.BUILD_BRANCH == env.STABLE_BRANCH }}
91+ run : |
92+ rm -rf /tmp/.buildx-cache
93+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
7894
7995 - name : Build and push latest stable branch for s6
8096 if : ${{ env.BUILD_BRANCH == env.STABLE_BRANCH }}
@@ -101,6 +117,14 @@ jobs:
101117 ghcr.io/${{ github.repository }}:s6-latest
102118 ghcr.io/${{ github.repository }}:s6-${{ env.BUILD_BRANCH }}
103119 ghcr.io/${{ github.repository }}:s6-${{ env.BUILD_VER }}
120+ cache-from : type=local,src=/tmp/.buildx-cache
121+ cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
122+
123+ - name : Move cache for s6
124+ if : ${{ env.BUILD_BRANCH == env.STABLE_BRANCH }}
125+ run : |
126+ rm -rf /tmp/.buildx-cache
127+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
104128
105129 - name : Build and push everything else
106130 if : ${{ env.BUILD_BRANCH != env.STABLE_BRANCH }}
@@ -125,6 +149,14 @@ jobs:
125149 ${{ env.DOCKER_IMAGE }}:${{ env.BUILD_VER }}
126150 ghcr.io/${{ github.repository }}:${{ env.BUILD_BRANCH }}
127151 ghcr.io/${{ github.repository }}:${{ env.BUILD_VER }}
152+ cache-from : type=local,src=/tmp/.buildx-cache
153+ cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
154+
155+ - name : Move cache
156+ if : ${{ env.BUILD_BRANCH != env.STABLE_BRANCH }}
157+ run : |
158+ rm -rf /tmp/.buildx-cache
159+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
128160
129161 - name : Build and push everything else for s6
130162 if : ${{ env.BUILD_BRANCH != env.STABLE_BRANCH }}
@@ -149,3 +181,11 @@ jobs:
149181 ${{ env.DOCKER_IMAGE }}:s6-${{ env.BUILD_VER }}
150182 ghcr.io/${{ github.repository }}:s6-${{ env.BUILD_BRANCH }}
151183 ghcr.io/${{ github.repository }}:s6-${{ env.BUILD_VER }}
184+ cache-from : type=local,src=/tmp/.buildx-cache
185+ cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
186+
187+ - name : Move cache for s6
188+ if : ${{ env.BUILD_BRANCH != env.STABLE_BRANCH }}
189+ run : |
190+ rm -rf /tmp/.buildx-cache
191+ mv /tmp/.buildx-cache-new /tmp/.buildx-cache
0 commit comments