Skip to content

Commit b1bbbca

Browse files
authored
ci(publish): add ability to disable build cache (#22)
1 parent 3fe1426 commit b1bbbca

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

.github/workflows/publish-2.7.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ on:
99
- '.github/workflows/publish-2.7.yml'
1010
- '2.7/**'
1111
schedule:
12-
- cron: '0 8 * * 2,6'
12+
- cron: '0 9 * * 2,6'
13+
- cron: '30 6 1 * *'
1314

1415
jobs:
1516
publish:
@@ -32,6 +33,7 @@ jobs:
3233
with:
3334
image: coatldev/python
3435
version: ${{ matrix.image.version }}
36+
build-cache: ${{ github.event.schedule == '30 6 1 * *' && 'true' || 'false' }}
3537
variant: ${{ matrix.image.variant }}
3638
tags: ${{ matrix.image.tags }}
3739
username: ${{ vars.DOCKERHUB_USERNAME }}

.github/workflows/publish-3.12.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ on:
99
- '.github/workflows/publish-3.12.yml'
1010
- '3.12/**'
1111
schedule:
12-
- cron: '0 8 * * 1,5'
12+
- cron: '0 9 * * 1,5'
13+
- cron: '30 6 1 * *'
1314

1415
jobs:
1516
tagger:
1617
runs-on: ubuntu-latest
1718
outputs:
1819
major: ${{ steps.tags.outputs.major }}
19-
major_minor: ${{ steps.tags.outputs.major_minor }}
20+
major-minor: ${{ steps.tags.outputs.major-minor }}
2021
version: ${{ steps.tags.outputs.version }}
2122

2223
steps:
@@ -37,7 +38,7 @@ jobs:
3738
echo "MAJOR=${MAJOR}"
3839
# Export the extracted version to GITHUB_OUTPUT
3940
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
40-
echo "major_minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
41+
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
4142
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4243
4344
publish:
@@ -49,16 +50,17 @@ jobs:
4950
- version: '3.12'
5051
variant: bookworm
5152
tags: |
52-
${{ needs.tagger.outputs.major_minor }}
53+
${{ needs.tagger.outputs.major-minor }}
5354
${{ needs.tagger.outputs.version }}
5455
- version: '3.12'
5556
variant: slim-bookworm
5657
tags: |
57-
${{ needs.tagger.outputs.major_minor }}-slim
58+
${{ needs.tagger.outputs.major-minor }}-slim
5859
${{ needs.tagger.outputs.version }}-slim
5960
with:
6061
image: coatldev/python
6162
version: ${{ matrix.image.version }}
63+
build-cache: ${{ github.event.schedule == '30 6 1 * *' && 'true' || 'false' }}
6264
variant: ${{ matrix.image.variant }}
6365
tags: ${{ matrix.image.tags }}
6466
username: ${{ vars.DOCKERHUB_USERNAME }}

.github/workflows/publish-3.13.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ on:
99
- '.github/workflows/publish-3.13.yml'
1010
- '3.13/**'
1111
schedule:
12-
- cron: '0 8 * * 0,4'
12+
- cron: '0 9 * * 0,4'
13+
- cron: '30 6 1 * *'
1314

1415
jobs:
1516
tagger:
1617
runs-on: ubuntu-latest
1718
outputs:
1819
major: ${{ steps.tags.outputs.major }}
19-
major_minor: ${{ steps.tags.outputs.major_minor }}
20+
major-minor: ${{ steps.tags.outputs.major-minor }}
2021
version: ${{ steps.tags.outputs.version }}
2122

2223
steps:
@@ -37,7 +38,7 @@ jobs:
3738
echo "MAJOR=${MAJOR}"
3839
# Export the extracted version to GITHUB_OUTPUT
3940
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
40-
echo "major_minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
41+
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
4142
echo "version=${VERSION}" >> $GITHUB_OUTPUT
4243
4344
publish:
@@ -50,17 +51,18 @@ jobs:
5051
variant: bookworm
5152
tags: |
5253
${{ needs.tagger.outputs.major }}
53-
${{ needs.tagger.outputs.major_minor }}
54+
${{ needs.tagger.outputs.major-minor }}
5455
${{ needs.tagger.outputs.version }}
5556
- version: '3.13'
5657
variant: slim-bookworm
5758
tags: |
5859
${{ needs.tagger.outputs.major }}-slim
59-
${{ needs.tagger.outputs.major_minor }}-slim
60+
${{ needs.tagger.outputs.major-minor }}-slim
6061
${{ needs.tagger.outputs.version }}-slim
6162
with:
6263
image: coatldev/python
6364
version: ${{ matrix.image.version }}
65+
build-cache: ${{ github.event.schedule == '30 6 1 * *' && 'true' || 'false' }}
6466
variant: ${{ matrix.image.variant }}
6567
tags: ${{ matrix.image.tags }}
6668
username: ${{ vars.DOCKERHUB_USERNAME }}

.github/workflows/publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ on:
88
Docker image to use as base name for tags.
99
required: true
1010
type: string
11+
build-cache:
12+
description: >-
13+
Use cache when building the image.
14+
required: false
15+
type: string
16+
default: 'true'
1117
version:
1218
description: >-
1319
Python version to release.
@@ -44,6 +50,7 @@ jobs:
4450
registry-username: ${{ inputs.username }}
4551
build-file: ${{ inputs.version }}/${{ inputs.variant }}/Dockerfile
4652
build-cache-key: ${{ inputs.version }}-${{ inputs.variant }}
53+
build-cache: ${{ fromJson(inputs.build-cache) }}
4754
build-digest-key: ${{ inputs.version }}-${{ inputs.variant }}
4855
secrets:
4956
registry-password: ${{ secrets.password }}

0 commit comments

Comments
 (0)