Skip to content

Commit 3c615a0

Browse files
committed
Improve CI Docker cache reuse
1 parent 2b52960 commit 3c615a0

1 file changed

Lines changed: 21 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ on:
1414
pull_request:
1515
branches:
1616
- "main"
17+
paths-ignore:
18+
- "docs/**"
19+
- "README.md"
20+
- ".github/workflows/release.yml"
21+
- ".github/workflows/official-site.yml"
22+
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
25+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1726

1827
env:
1928
CARGO_TERM_COLOR: always
@@ -175,13 +184,10 @@ jobs:
175184
labels: ${{ steps.meta.outputs.labels }}
176185
push: ${{ github.event_name != 'pull_request' }}
177186
tags: ${{ steps.meta.outputs.tags }}
178-
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:main${{ steps.suffix.outputs.suffix }}
179-
# don't save cache on prs
180-
cache-to: >
181-
${{ github.event_name != 'pull_request'
182-
&& format('type=registry,ref={0}:main{1},compression=zstd,mode=max', env.REGISTRY_IMAGE, steps.suffix.outputs.suffix)
183-
|| ''
184-
}}
187+
cache-from: |
188+
type=gha,scope=sqlpage${{ steps.suffix.outputs.suffix }}
189+
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main${{ steps.suffix.outputs.suffix }}
190+
cache-to: type=gha,scope=sqlpage${{ steps.suffix.outputs.suffix }},mode=max
185191
- name: Export digest
186192
if: github.event_name != 'pull_request'
187193
run: |
@@ -228,7 +234,10 @@ jobs:
228234
${{ steps.meta.outputs.tags }}
229235
${{ env.REGISTRY_IMAGE }}:main
230236
outputs: type=docker,dest=${{ runner.temp }}/sqlpage.tar
231-
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
237+
cache-from: |
238+
type=gha,scope=sqlpage-linux-amd64
239+
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
240+
cache-to: type=gha,scope=sqlpage-linux-amd64,mode=max
232241
- name: Upload SQLPage image
233242
uses: actions/upload-artifact@v7
234243
with:
@@ -247,8 +256,10 @@ jobs:
247256
labels: ${{ steps.meta.outputs.labels }}
248257
push: true
249258
tags: ${{ steps.meta.outputs.tags }}
250-
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
251-
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64,compression=zstd,mode=max
259+
cache-from: |
260+
type=gha,scope=sqlpage-linux-amd64
261+
type=registry,ref=${{ env.REGISTRY_IMAGE }}:main-linux-amd64
262+
cache-to: type=gha,scope=sqlpage-linux-amd64,mode=max
252263
- name: Export digest
253264
if: github.event_name != 'pull_request'
254265
run: |

0 commit comments

Comments
 (0)