1
+ name : Docker images test
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ commit_sha :
7
+ description : |
8
+ SHA of the commit on which the mithril binaries should be obtained, a "ci.yml" workflow must have run
9
+ on it else no binary would be available leading to the failure of this.
10
+
11
+ If not provided the last commit on the main branch will be used instead.
12
+ required : false
13
+ type : string
14
+ dry_run :
15
+ description : Dry run will not push the Docker images to the registry
16
+ required : true
17
+ type : bool
18
+ default : false
19
+
20
+ jobs :
21
+ build-push-docker :
22
+ runs-on : ubuntu-22.04
23
+ strategy :
24
+ fail-fast : false
25
+ matrix :
26
+ project : [ mithril-aggregator, mithril-client, mithril-signer ]
27
+
28
+ permissions :
29
+ contents : read
30
+ packages : write
31
+
32
+ env :
33
+ REGISTRY : ghcr.io
34
+ IMAGE_NAME : ${{ github.repository_owner }}/${{ matrix.project }}
35
+ DOCKER_FILE : ./${{ matrix.project }}/Dockerfile.ci
36
+ CONTEXT : .
37
+ GITHUB_REF : ${{ github.ref}}
38
+
39
+ steps :
40
+ - name : Prepare environment variables
41
+ id : prepare
42
+ shell : bash
43
+ run : |
44
+ if [[ -n "${{ inputs.commit_sha }}" ]]; then
45
+ echo "sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
46
+ else
47
+ echo "branch=main" >> $GITHUB_OUTPUT
48
+ fi
49
+
50
+ - name : Checkout
51
+ uses : actions/checkout@v3
52
+
53
+ - name : Checkout binary
54
+ uses : dawidd6/action-download-artifact@v2
55
+ with :
56
+ name : mithril-distribution-${{ runner.os }}-${{ runner.arch }}
57
+ path : ./bin
58
+ commit : ${{ steps.prepare.outputs.sha }}
59
+ branch : ${{ steps.prepare.outputs.branch }}
60
+ workflow : ci.yml
61
+ workflow_conclusion : success
62
+
63
+ - name : Log in to the Container registry
64
+ uses : docker/login-action@v2
65
+ with :
66
+ registry : ${{ env.REGISTRY }}
67
+ username : ${{ github.actor }}
68
+ password : ${{ secrets.GITHUB_TOKEN }}
69
+
70
+ - name : Extract metadata (tags, labels) for Docker
71
+ id : meta
72
+ uses : docker/metadata-action@v4
73
+ with :
74
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
75
+ tags : |
76
+ test
77
+ type=raw,value=test-${{ github.ref_name }}-{{ steps.prepare.outputs.sha }}
78
+
79
+ - name : Download built artifacts (Linux-x64)
80
+ uses : dawidd6/action-download-artifact@v2
81
+ with :
82
+ name : mithril-distribution-Linux-X64
83
+ path : ${{ matrix.project }}
84
+ commit : ${{ steps.prepare.outputs.sha }}
85
+ workflow : ci.yml
86
+ workflow_conclusion : success
87
+
88
+ - name : Build and push Docker image
89
+ uses : docker/build-push-action@v3
90
+ if : ${{ inputs.dry_run }} == 'false'
91
+ with :
92
+ context : ${{ env.CONTEXT }}
93
+ file : ${{ env.DOCKER_FILE }}
94
+ push : true
95
+ tags : ${{ steps.meta.outputs.tags }}
0 commit comments