Skip to content

Commit dfe842b

Browse files
authored
ci(publish): build the image without cache once a month (#163)
autoupdate: - update schedule for git
1 parent acfe1a4 commit dfe842b

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

.github/workflows/auto-update.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: auto-update
33
on:
44
schedule:
55
- cron: '0 12 * * 0,4'
6-
- cron: '0 18 14,28 * *' # Git
6+
- cron: '0 18 7,21 * *' # Git
77
- cron: '0 18 10 2-12/2 *' # Python release schedule
88
workflow_dispatch:
99

@@ -15,7 +15,7 @@ jobs:
1515
uses: actions/checkout@v4
1616

1717
- name: Fetch latest Git release
18-
if: ${{ github.event.schedule == '0 18 14,28 * *' || github.event_name == 'workflow_dispatch' }}
18+
if: ${{ github.event.schedule == '0 18 7,21 * *' || github.event_name == 'workflow_dispatch' }}
1919
run: |
2020
git_version=$(git ls-remote --tags https://github.com/git/git | grep -o 'refs/tags/v[0-9]*\.[0-9]*\.[0-9]*$' | sort -V | tail -n1 | sed 's/refs\/tags\///' | sed 's/^v//')
2121

.github/workflows/publish.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ on:
99
- 'Dockerfile'
1010
schedule:
1111
- cron: '0 20 * * 2,6'
12+
- cron: '0 16 1 * *'
13+
workflow_dispatch:
1214

1315
jobs:
14-
tagger:
16+
pre-build:
1517
runs-on: ubuntu-latest
1618
outputs:
1719
version: ${{ steps.tags.outputs.version }}
18-
major_minor: ${{ steps.tags.outputs.major_minor }}
20+
major-minor: ${{ steps.tags.outputs.major-minor }}
21+
build-cache: ${{ steps.set-build-cache.outputs.build-cache }}
1922

2023
steps:
2124
- name: Checkout
@@ -32,19 +35,29 @@ jobs:
3235
echo "MAJOR_MINOR=${MAJOR_MINOR}"
3336
# Export the extracted version to GITHUB_OUTPUT
3437
echo "version=${VERSION}" >> $GITHUB_OUTPUT
35-
echo "major_minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
38+
echo "major-minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
39+
40+
- name: Set build cache flag
41+
id: set-build-cache
42+
run: |
43+
if [[ "${{ github.event.schedule }}" == '0 16 1 * *' || "${{ github.event_name }}" == 'workflow_dispatch' ]]; then
44+
echo "build-cache=false" >> $GITHUB_ENV
45+
else
46+
echo "build-cache=true" >> $GITHUB_ENV
47+
fi
3648
3749
build:
38-
needs: tagger
50+
needs: pre-build
3951
uses: coatl-dev/workflows/.github/workflows/docker-build-push-multi-registry.yml@v4
4052
with:
4153
dockerhub-repo: coatldev/six
4254
dockerhub-username: ${{ vars.DOCKERHUB_USERNAME }}
4355
quay-repo: quay.io/coatldev/six
4456
quay-username: ${{ vars.QUAY_USERNAME }}
57+
build-cache: ${{ needs.pre-build.outputs.build-cache }}
4558
metadata-tags: |
46-
type=raw,value=${{ needs.tagger.outputs.version }}
47-
type=raw,value=${{ needs.tagger.outputs.major_minor }}
59+
type=raw,value=${{ needs.pre-build.outputs.version }}
60+
type=raw,value=${{ needs.pre-build.outputs.major-minor }}
4861
type=raw,value=latest,enable={{is_default_branch}}
4962
secrets:
5063
dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}

0 commit comments

Comments
 (0)