1010 - ' **/README.md'
1111 workflow_dispatch :
1212
13+ schedule :
14+ # run on Saturday at 10:00 UTC
15+ - cron : ' 0 10 * * 6'
16+
1317concurrency :
1418 group : ${{ github.workflow }}-${{ github.ref || github.run_id }}
1519 cancel-in-progress : true
@@ -34,10 +38,38 @@ jobs:
3438 uses : ./.github/actions/config
3539 id : set
3640
41+ check-update :
42+ name : Check for updates
43+ if : github.event_name == 'schedule'
44+ needs : set-env
45+ runs-on : ubuntu-latest
46+ outputs :
47+ res : ${{ steps.check-update.outputs.res }}
48+ steps :
49+ - name : Log in to registry
50+ shell : bash
51+ run : podman login ${{ needs.set-env.outputs.REGISTRY }} -u ${{ needs.set-env.outputs.REGISTRY_USER }} -p ${{ secrets.QUAY_PASSWORD }}
52+
53+ - name : Check update
54+ id : check-update
55+ shell : bash
56+ run : |
57+ # 'dnf check-update'
58+ # exit codes:
59+ # 0 - no updates
60+ # 100 - updates available
61+ # 125 - tag/platform not found
62+ # 127 - command not found
63+ res=0
64+ podman run --quiet --rm ${{ needs.set-env.outputs.IMAGE_REF }}:latest dnf check-update || res=$?
65+ echo "res=${res}" >> "$GITHUB_OUTPUT"
66+ echo "Exit code: '$res'"
67+
3768 build-image :
3869 name : Build image
3970 uses : AlmaLinux/atomic-ci/.github/workflows/build-image.yml@v6
40- needs : set-env
71+ needs : [set-env, check-update]
72+ if : ${{ !failure() && !cancelled() && (github.event_name != 'schedule' || needs.check-update.outputs.res != 0) }}
4173 with :
4274 containerfile : Dockerfile
4375 image-name : " ${{ needs.set-env.outputs.IMAGE_NAME }}"
6395 test-image :
6496 name : Test image
6597 runs-on : ubuntu-latest
66- needs : [set-env, build-image]
98+ needs : [set-env, check-update, build-image]
99+ if : ${{ !failure() && !cancelled() && (github.event_name != 'schedule' || needs.check-update.outputs.res != 0) }}
67100
68101 env :
69102 IMAGE_REF : " ${{ needs.build-image.outputs.image-ref }}@${{ needs.build-image.outputs.digest }}"
89122
90123 promote-image :
91124 name : Promote image
92- needs : [set-env, build-image, test-image]
93- if : ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
125+ needs : [set-env, check-update, build-image, test-image]
126+ if : ${{ !failure() && !cancelled() && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name != 'schedule' || needs.check-update.outputs.res != 0 ) }}
94127 uses : AlmaLinux/atomic-ci/.github/workflows/retag-image.yml@v6
95128 with :
96129 image : ${{ needs.build-image.outputs.image-ref }}@${{ needs.build-image.outputs.digest }}
@@ -108,8 +141,8 @@ jobs:
108141
109142 create-release :
110143 name : Create Release
111- needs : [set-env, build-image, test-image, promote-image]
112- if : ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
144+ needs : [set-env, check-update, build-image, test-image, promote-image]
145+ if : ${{ !failure() && !cancelled() && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && (github.event_name != 'schedule' || needs.check-update.outputs.res != 0 ) }}
113146 uses : AlmaLinux/atomic-ci/.github/workflows/create-release.yml@v6
114147 with :
115148 image-name : " ${{ needs.set-env.outputs.IMAGE_NAME }}"
0 commit comments