11name : Docker CI
22
33on :
4+ release :
5+ types : [created, published]
46 push :
57 branches :
68 - " **"
@@ -23,18 +25,51 @@ jobs:
2325 dockerfile : Dockerfile
2426
2527 build-and-publish-docker :
26- needs : lint-docker
27- uses : ./.github/workflows/publish.yaml
28- permissions :
29- id-token : write
30- contents : read
31- with :
32- ref : ${{ github.ref }}
33- image-tag : |
34- type=schedule
35- type=ref,event=branch
36- type=ref,event=pr
37- type=ref,event=tag
38- secrets :
39- registry_username : ${{ secrets.DOCKERHUB_USERNAME }}
40- registry_password : ${{ secrets.DOCKERHUB_TOKEN }}
28+ runs-on : ubuntu-latest
29+ needs :
30+ - lint-docker
31+ steps :
32+ - name : Checkout code
33+ uses : actions/checkout@v4
34+ with :
35+ fetch-depth : 0 # Ensure full history
36+
37+ - name : Docker meta
38+ id : docker_meta
39+ uses : docker/metadata-action@v5
40+ with :
41+ images : inseefrlab/s3-operator # list of Docker images to use as base name for tags
42+ tags : |
43+ type=ref,event=branch
44+ type=ref,event=pr
45+ type=semver,pattern=v{{version}}
46+ type=semver,pattern=v{{major}}.{{minor}}
47+ type=semver,pattern=v{{major}}
48+
49+ - name : Set up QEMU
50+ uses : docker/setup-qemu-action@v3
51+
52+ - name : Set up Docker Buildx
53+ uses : docker/setup-buildx-action@v3
54+
55+ - name : Login to DockerHub
56+ if : github.event_name != 'pull_request'
57+ uses : docker/login-action@v3
58+ with :
59+ username : ${{ secrets.registry_username }}
60+ password : ${{ secrets.registry_password }}
61+
62+ - name : Build and push
63+ id : build_push
64+ uses : docker/build-push-action@v6
65+ with :
66+ context : .
67+ file : ./Dockerfile
68+ push : ${{ github.event_name != 'pull_request' }}
69+ tags : |
70+ ${{ steps.docker_meta.outputs.tags }}
71+ labels : ${{ steps.docker_meta.outputs.labels }}
72+ platforms : linux/amd64,linux/arm64
73+
74+ - name : Image digest
75+ run : echo ${{ steps.build_push.outputs.digest }}
0 commit comments