10
10
schedule :
11
11
# '*' is a special character in YAML, so string must be quoted
12
12
- cron : " 0 1 * * *"
13
+ push :
14
+ branches :
15
+ - " **"
16
+ tags :
17
+ - " v*"
18
+ pull_request :
19
+ branches :
20
+ - main
21
+ merge_group :
22
+ branches :
23
+ - main
13
24
workflow_dispatch :
14
25
inputs :
15
26
tag_prefix :
54
65
type : string
55
66
required : true
56
67
68
+ env :
69
+ publish : ${{ github.repository == 'FEniCS/dolfinx' && ( github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') ) }}
70
+
57
71
jobs :
58
72
create_end_user_images :
59
73
name : Build DOLFINx end-user images
@@ -100,18 +114,21 @@ jobs:
100
114
repository : " FEniCS/basix"
101
115
path : " basix"
102
116
ref : ${{ env.BASIX_REF }}
117
+
103
118
- name : Checkout UFL
104
119
uses : actions/checkout@v4
105
120
with :
106
121
repository : " FEniCS/ufl"
107
122
path : " ufl"
108
123
ref : ${{ env.UFL_REF }}
124
+
109
125
- name : Checkout FFCx
110
126
uses : actions/checkout@v4
111
127
with :
112
128
repository : " FEniCS/ffcx"
113
129
path : " ffcx"
114
130
ref : ${{ env.FFCX_REF }}
131
+
115
132
- name : Checkout DOLFINx
116
133
uses : actions/checkout@v4
117
134
with :
@@ -122,6 +139,7 @@ jobs:
122
139
- name : Set default FFCx options
123
140
run : |
124
141
echo '{ }' > dolfinx/docker/ffcx_options.json
142
+
125
143
- name : Set default DOLFINx JIT options
126
144
run : |
127
145
echo '{ "cffi_extra_compile_args" : ["-O2"] } ' > dolfinx/docker/dolfinx_jit_options.json
@@ -182,17 +200,21 @@ jobs:
182
200
/bin/bash -c "source /usr/local/bin/dolfinx-complex-mode && python3 -c $'import dolfinx; from dolfinx.fem import functionspace; from dolfinx.mesh import create_unit_square; from mpi4py import MPI; mesh = create_unit_square(MPI.COMM_WORLD, 10, 10); V = functionspace(mesh, (\"Lagrange\", 1));'"
183
201
184
202
- name : Login to Docker Hub
203
+ if : ${{ env.publish == 'true' }}
185
204
uses : docker/login-action@v3
186
205
with :
187
206
username : ${{ secrets.DOCKERHUB_USERNAME }}
188
207
password : ${{ secrets.DOCKERHUB_TOKEN }}
208
+
189
209
- name : Push to the DockerHub registry
210
+ if : ${{ env.publish == 'true' }}
190
211
run : |
191
212
docker push docker.io/dolfinx/dolfinx-onbuild:${{ env.TAG }}
192
213
docker push docker.io/dolfinx/dolfinx:${{ env.TAG }}
193
214
docker push docker.io/dolfinx/lab:${{ env.TAG }}
194
215
195
216
- name : Cleanup
217
+ if : ${{ env.publish == 'true' }}
196
218
run : |
197
219
docker rmi docker.io/dolfinx/lab:${{ env.TAG }}
198
220
docker rmi docker.io/dolfinx/dolfinx:${{ env.TAG }}
@@ -212,19 +234,22 @@ jobs:
212
234
echo "TAG=${USER_INPUT:-nightly}" >> $GITHUB_ENV
213
235
214
236
- name : Login to Docker Hub
237
+ if : ${{ env.publish == 'true' }}
215
238
uses : docker/login-action@v3
216
239
with :
217
240
username : ${{ secrets.DOCKERHUB_USERNAME }}
218
241
password : ${{ secrets.DOCKERHUB_TOKEN }}
219
242
220
243
- name : Login to GitHub Container Registry
244
+ if : ${{ env.publish == 'true' }}
221
245
uses : docker/login-action@v3
222
246
with :
223
247
registry : ghcr.io
224
248
username : ${{ github.repository_owner }}
225
249
password : ${{ secrets.GITHUB_TOKEN }}
226
250
227
251
- name : Push multiarch images to ghcr.io and docker.io
252
+ if : ${{ env.publish == 'true' }}
228
253
run : |
229
254
GH_PREFIX="ghcr.io/fenics/dolfinx"
230
255
DH_PREFIX="docker.io/dolfinx"
0 commit comments