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
+ cardano_bin_url :
15
+ description : The url of the archive of the Cardano Node/CLI binaries
16
+ required : true
17
+ type : string
18
+ default : https://update-cardano-mainnet.iohk.io/cardano-node-releases/cardano-node-1.35.5-linux.tar.gz
19
+ dry_run :
20
+ description : Dry run will not push the Docker images to the registry
21
+ required : true
22
+ type : boolean
23
+ default : false
24
+
25
+ jobs :
26
+ build-push-docker :
27
+ runs-on : ubuntu-22.04
28
+ strategy :
29
+ fail-fast : false
30
+ matrix :
31
+ project : [ mithril-aggregator, mithril-client, mithril-signer ]
32
+
33
+ permissions :
34
+ contents : read
35
+ packages : write
36
+
37
+ env :
38
+ REGISTRY : ghcr.io
39
+ IMAGE_NAME : ${{ github.repository_owner }}/${{ matrix.project }}
40
+ DOCKER_FILE : ./${{ matrix.project }}/Dockerfile.ci
41
+ CONTEXT : .
42
+ GITHUB_REF : ${{ github.ref}}
43
+
44
+ steps :
45
+ - name : Prepare environment variables
46
+ id : prepare
47
+ shell : bash
48
+ run : |
49
+ if [[ -n "${{ inputs.commit_sha }}" ]]; then
50
+ echo "sha=${{ inputs.commit_sha }}" >> $GITHUB_OUTPUT
51
+ else
52
+ echo "branch=main" >> $GITHUB_OUTPUT
53
+ fi
54
+
55
+ - name : Checkout
56
+ uses : actions/checkout@v3
57
+
58
+ - name : Checkout binary
59
+ uses : dawidd6/action-download-artifact@v2
60
+ with :
61
+ name : mithril-distribution-${{ runner.os }}-${{ runner.arch }}
62
+ path : ./bin
63
+ commit : ${{ steps.prepare.outputs.sha }}
64
+ branch : ${{ steps.prepare.outputs.branch }}
65
+ workflow : ci.yml
66
+ workflow_conclusion : success
67
+
68
+ - name : Log in to the Container registry
69
+ uses : docker/login-action@v2
70
+ with :
71
+ registry : ${{ env.REGISTRY }}
72
+ username : ${{ github.actor }}
73
+ password : ${{ secrets.GITHUB_TOKEN }}
74
+
75
+ - name : Extract metadata (tags, labels) for Docker
76
+ id : meta
77
+ uses : docker/metadata-action@v4
78
+ with :
79
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
80
+ tags : |
81
+ test
82
+ type=raw,value=test-${{ github.ref_name }}-{{ steps.prepare.outputs.sha }}
83
+
84
+ - name : Download built artifacts (Linux-x64)
85
+ uses : dawidd6/action-download-artifact@v2
86
+ with :
87
+ name : mithril-distribution-Linux-X64
88
+ path : ${{ matrix.project }}
89
+ commit : ${{ steps.prepare.outputs.sha }}
90
+ workflow : ci.yml
91
+ workflow_conclusion : success
92
+
93
+ - name : Build and push Docker image
94
+ uses : docker/build-push-action@v3
95
+ if : ${{ inputs.dry_run }} == 'false'
96
+ with :
97
+ context : ${{ env.CONTEXT }}
98
+ file : ${{ env.DOCKER_FILE }}
99
+ build-args : CARDANO_BIN_URL=${{ steps.inputs.cardano_bin_url }}
100
+ push : true
101
+ tags : ${{ steps.meta.outputs.tags }}
0 commit comments