@@ -2,12 +2,13 @@ name: Docker
2
2
on :
3
3
push :
4
4
branches :
5
- - main
5
+ - main
6
6
tags :
7
- - v*.*.*
7
+ - v*.*.*
8
8
pull_request :
9
9
schedule :
10
- - cron : 16 9 * * *
10
+ - cron : 16 9 * * *
11
+ workflow_dispatch :
11
12
12
13
env :
13
14
# Use docker.io for Docker Hub if empty
@@ -26,139 +27,140 @@ jobs:
26
27
fail-fast : false
27
28
matrix :
28
29
container :
29
- - 7z
30
- - abe
31
- - adb
32
- - ansible
33
- - apg
34
- - audiosprite
35
- - aws-cli
36
- - bind
37
- - black
38
- - blampy
39
- - bpython
40
- - cdk
41
- - chardet
42
- - checkmake
43
- - chrome
44
- - compose_sort
45
- - firefox
46
- - fzf
47
- - ghlatest
48
- - goenv
49
- - graphviz
50
- - grta
51
- - haskellenv
52
- - httpie
53
- - hugo
54
- - jq
55
- - json-server
56
- - kp1p
57
- - lxde
58
- - minidlna
59
- - mssql-cli
60
- - mssql-scripter
61
- - myip
62
- - mypy
63
- - ods_conv
64
- - pdf
65
- - pwgen
66
- - pycodestyle
67
- - pygmentize
68
- - pylint
69
- - qrencode
70
- - shunit2
71
- - snakeeyes
72
- - sql-formatter
73
- - tsqllint
74
- - vueenv
75
- - wimlib-imagex
76
- - wireguard
77
- - wpa_passphrase
78
- - yamllint
79
- - youtube-dl
80
- - yq
30
+ - 7z
31
+ - abe
32
+ - adb
33
+ - ansible
34
+ - apg
35
+ - audiosprite
36
+ - aws-cli
37
+ - bind
38
+ - black
39
+ - blampy
40
+ - bpython
41
+ - cdk
42
+ - chardet
43
+ - checkmake
44
+ - chrome
45
+ - compose_sort
46
+ - firefox
47
+ - fzf
48
+ - ghlatest
49
+ - goenv
50
+ - graphviz
51
+ - grta
52
+ - haskellenv
53
+ - httpie
54
+ - hugo
55
+ - jq
56
+ - json-server
57
+ - kp1p
58
+ - lxde
59
+ - minidlna
60
+ - mssql-cli
61
+ - mssql-scripter
62
+ - myip
63
+ - mypy
64
+ - ods_conv
65
+ - pdf
66
+ - pwgen
67
+ - pycodestyle
68
+ - pygmentize
69
+ - pylint
70
+ - qrencode
71
+ - shunit2
72
+ - snakeeyes
73
+ - sql-formatter
74
+ - tsqllint
75
+ - vueenv
76
+ - wimlib-imagex
77
+ - wireguard
78
+ - wpa_passphrase
79
+ - yamllint
80
+ - youtube-dl
81
+ - yq
82
+
81
83
steps :
82
84
83
- - name : Checkout repository
84
- uses : actions/checkout@v2
85
-
86
- - name : Load Custom Data
87
- id : cdata
88
- run : |
89
- #!/bin/sh
90
- set -ex
91
-
92
- # ensure the required environment variables are set
93
- : "${REGISTRY:?}" # this is used in subsequent steps
94
- : "${ORG:?}"
95
- : "${PSUM_LABEL:?}"
96
- : "${PLATFORMS_OVERRIDE:?}"
97
-
98
- # helper functions
99
- output() {
100
- printf '::set-output name=%s::%s\n' "$1" "$2"
101
- }
102
-
103
- # calculate perishable checksum
104
- psum="$(.helpers/context_psum.py "${{ matrix.container }}")"
105
-
106
- # determine if that perishable checksum matches the one already on docker hub; if so, skip the build
107
- skipbuild=0
108
- hub_psum="$(.helpers/hub_manifest.py --keypath "config/Labels/${PSUM_LABEL}" "${ORG}/${{ matrix.container }}" || true)"
109
- if [ "$psum" = "$hub_psum" ]; then
110
- skipbuild=1
111
- fi
112
-
113
- # platforms
114
- platforms="linux/amd64,linux/arm64,linux/arm/v7"
115
- override="${{ matrix.container }}/${PLATFORMS_OVERRIDE}"
116
- if [ -f "$override" ]; then
117
- platforms="$(cat "$override")"
118
- fi
119
-
120
- # output the outputs
121
- output "psum" "$psum"
122
- output "skipbuild" "$skipbuild"
123
- output "platforms" "$platforms"
124
-
125
- - name : Set up QEMU
126
- if : ${{ steps.cdata.outputs.skipbuild != '1' }}
127
- uses : docker/setup-qemu-action@v1
128
-
129
- - name : Set up Docker Buildx
130
- if : ${{ steps.cdata.outputs.skipbuild != '1' }}
131
- uses : docker/setup-buildx-action@v1
132
-
133
- - name : Login to Docker Hub
134
- if : ${{ steps.cdata.outputs.skipbuild != '1' }}
135
- uses : docker/login-action@v1
136
- with :
137
- registry : ${{ env.REGISTRY }}
138
- username : ${{ github.actor }}
139
- password : ${{ secrets.DOCKER_HUB_TOKEN }}
140
-
141
- - name : Extract Docker metadata
142
- if : ${{ steps.cdata.outputs.skipbuild != '1' }}
143
- id : meta
144
- uses : docker/metadata-action@v3
145
- with :
146
- images : ${{ env.REGISTRY }}/${{ env.ORG }}/${{ matrix.container }}
147
- tags : |
148
- type=raw,value=latest
149
- flavor : |
150
- latest=false
151
-
152
- # Build and push Docker image with Buildx (don't push on PR)
153
- # https://github.com/docker/build-push-action
154
- - name : Build and push Docker image
155
- if : ${{ steps.cdata.outputs.skipbuild != '1' }}
156
- uses : docker/build-push-action@v2
157
- with :
158
- context : ${{ matrix.container }}
159
- push : ${{ github.event_name != 'pull_request' }}
160
- tags : ${{ steps.meta.outputs.tags }}
161
- labels : |
162
- ${{ steps.meta.outputs.labels }}
163
- ${{ env.PSUM_LABEL }}=${{ steps.cdata.outputs.psum }}
164
- platforms : ${{ steps.cdata.outputs.platforms }}
85
+ - name : Checkout repository
86
+ uses : actions/checkout@v2
87
+
88
+ - name : Load Custom Data
89
+ id : cdata
90
+ run : |
91
+ #!/bin/sh
92
+ set -ex
93
+
94
+ # ensure the required environment variables are set
95
+ : "${REGISTRY:?}" # this is used in subsequent steps
96
+ : "${ORG:?}"
97
+ : "${PSUM_LABEL:?}"
98
+ : "${PLATFORMS_OVERRIDE:?}"
99
+
100
+ # helper functions
101
+ output() {
102
+ printf '::set-output name=%s::%s\n' "$1" "$2"
103
+ }
104
+
105
+ # calculate perishable checksum
106
+ psum="$(.helpers/context_psum.py "${{ matrix.container }}")"
107
+
108
+ # determine if that perishable checksum matches the one already on docker hub; if so, skip the build
109
+ skipbuild=0
110
+ hub_psum="$(.helpers/hub_manifest.py --keypath "config/Labels/${PSUM_LABEL}" "${ORG}/${{ matrix.container }}" || true)"
111
+ if [ "$psum" = "$hub_psum" ]; then
112
+ skipbuild=1
113
+ fi
114
+
115
+ # platforms
116
+ platforms="linux/amd64,linux/arm64,linux/arm/v7"
117
+ override="${{ matrix.container }}/${PLATFORMS_OVERRIDE}"
118
+ if [ -f "$override" ]; then
119
+ platforms="$(cat "$override")"
120
+ fi
121
+
122
+ # output the outputs
123
+ output "psum" "$psum"
124
+ output "skipbuild" "$skipbuild"
125
+ output "platforms" "$platforms"
126
+
127
+ - name : Set up QEMU
128
+ if : ${{ steps.cdata.outputs.skipbuild != '1' }}
129
+ uses : docker/setup-qemu-action@v1
130
+
131
+ - name : Set up Docker Buildx
132
+ if : ${{ steps.cdata.outputs.skipbuild != '1' }}
133
+ uses : docker/setup-buildx-action@v1
134
+
135
+ - name : Login to Docker Hub
136
+ if : ${{ steps.cdata.outputs.skipbuild != '1' }}
137
+ uses : docker/login-action@v1
138
+ with :
139
+ registry : ${{ env.REGISTRY }}
140
+ username : ${{ github.actor }}
141
+ password : ${{ secrets.DOCKER_HUB_TOKEN }}
142
+
143
+ - name : Extract Docker metadata
144
+ if : ${{ steps.cdata.outputs.skipbuild != '1' }}
145
+ id : meta
146
+ uses : docker/metadata-action@v3
147
+ with :
148
+ images : ${{ env.REGISTRY }}/${{ env.ORG }}/${{ matrix.container }}
149
+ tags : |
150
+ type=raw,value=latest
151
+ flavor : |
152
+ latest=false
153
+
154
+ # Build and push Docker image with Buildx (don't push on PR)
155
+ # https://github.com/docker/build-push-action
156
+ - name : Build and push Docker image
157
+ if : ${{ steps.cdata.outputs.skipbuild != '1' }}
158
+ uses : docker/build-push-action@v2
159
+ with :
160
+ context : ${{ matrix.container }}
161
+ push : ${{ github.event_name != 'pull_request' }}
162
+ tags : ${{ steps.meta.outputs.tags }}
163
+ labels : |
164
+ ${{ steps.meta.outputs.labels }}
165
+ ${{ env.PSUM_LABEL }}=${{ steps.cdata.outputs.psum }}
166
+ platforms : ${{ steps.cdata.outputs.platforms }}
0 commit comments