@@ -3,6 +3,8 @@ name: Build, publish and sign the reposync image
3
3
4
4
on :
5
5
workflow_dispatch :
6
+ schedule :
7
+ - cron : ' 17 6 * * *'
6
8
push :
7
9
branches : [ main ]
8
10
tags : [ 'v*.*.*' ]
24
26
25
27
steps :
26
28
- name : Checkout repository
27
- uses : actions/checkout@v2
29
+ uses : actions/checkout@v3
30
+
31
+ - name : Check for newer base image on scheduled runs
32
+ if : github.event_name == 'schedule'
33
+ run : |
34
+ BASE_LAYERS=$(skopeo inspect --config --no-tags docker://ghcr.io/oracle/oraclelinux8-python:3.9-amd64 | jq -r '.rootfs.diff_ids[]')
35
+ REPO_LAYERS=$(skopeo inspect --config --no-tags docker://ghcr.io/djelibeybi/ol-repo-sync:main | jq -r '.rootfs.diff_ids[]')
36
+ if [ -n "${REPO_LAYERS##*$BASE_LAYERS*}" ]; then
37
+ echo "BUILD_IMAGE=YES" >> $GITHUB_ENV
38
+ echo ""
39
+ else
40
+ echo "BUILD_IMAGE=NO" >> $GITHUB_ENV
41
+ fi
42
+
43
+ - name : Trigger builds for unscheduled runs
44
+ if : github.event_name != 'schedule'
45
+ run : |
46
+ echo "BUILD_IMAGE=YES" >> $GITHUB_ENV
28
47
29
48
- name : Install cosign
30
49
if : github.event_name != 'pull_request'
@@ -43,23 +62,24 @@ jobs:
43
62
username : ${{ github.actor }}
44
63
password : ${{ secrets.GITHUB_TOKEN }}
45
64
46
- - name : Extract Docker metadata
65
+ - name : Extract container metadata
47
66
id : meta
48
67
uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
49
68
with :
50
69
images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
51
70
52
- - name : Build and push Docker image
71
+ - name : Build and push container image
53
72
id : build-and-push
54
73
uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
74
+ if : env.BUILD_IMAGE == 'YES'
55
75
with :
56
76
context : .
57
77
platforms : linux/amd64,linux/arm64
58
78
push : ${{ github.event_name != 'pull_request' }}
59
79
tags : ${{ steps.meta.outputs.tags }}
60
80
labels : ${{ steps.meta.outputs.labels }}
61
81
62
- - name : Sign the published Docker image
82
+ - name : Sign the published container image
63
83
if : ${{ github.event_name != 'pull_request' }}
64
84
env :
65
85
COSIGN_EXPERIMENTAL : " true"
0 commit comments