@@ -9,23 +9,74 @@ inputs:
99 description : Is this a release build? If true, the latest tag will be applied
1010 required : false
1111 default : false
12+ node_version_key :
13+ required : false
14+ default : CARDANO_NODE_VERSION
15+ pg_version_key :
16+ required : false
17+ default : PG_VERSION_TAG
18+ mithril_version_key :
19+ required : false
20+ default : MITHRIL_VERSION
21+
1222secrets :
1323 DOCKERHUB_USERNAME :
1424 description : Docker Hub username
1525 required : true
16- DOCKERHUB_TOKEN :
17- description : Docker Hub token
18- required : true
26+ DOCKERHUB_TOKEN :
27+ description : Docker Hub token
28+ required : true
1929runs :
2030 using : composite
2131 steps :
32+ - name : Read versions from .env
33+ id : envver
34+ shell : bash
35+ run : |
36+ NODE_KEY='${{ inputs.node_version_key }}'
37+ PG_KEY='${{ inputs.pg_version_key }}'
38+ MITHRIL_KEY='${{ inputs.mithril_version_key }}'
39+
40+ if [[ ! -f .env ]]; then
41+ echo ".env not found"
42+ exit 0
43+ fi
44+
45+ get_val() {
46+ local key="$1"
47+ grep -E "^${key}=" .env | head -1 | cut -d= -f2- | tr -d '\r'
48+ }
49+
50+ NODE_VAL="$(get_val "$NODE_KEY")"
51+ PG_VAL="$(get_val "$PG_KEY")"
52+ MITHRIL_VAL="$(get_val "$MITHRIL_KEY")"
53+
54+ if [[ -n "$NODE_VAL" ]]; then
55+ echo "node_version=$NODE_VAL" >> "$GITHUB_OUTPUT"
56+ else
57+ echo "No value for $NODE_KEY in .env"
58+ fi
59+
60+ if [[ -n "$PG_VAL" ]]; then
61+ echo "pg_version=$PG_VAL" >> "$GITHUB_OUTPUT"
62+ else
63+ echo "No value for $PG_KEY in .env"
64+ fi
65+
66+ if [[ -n "$MITHRIL_VAL" ]]; then
67+ echo "mithril_version=$MITHRIL_VAL" >> "$GITHUB_OUTPUT"
68+ else
69+ echo "No value for $MITHRIL_KEY in .env"
70+ fi
71+
2272 - name : API - Build and push Docker ${{ inputs.tag }} image
2373 uses : docker/build-push-action@v4
2474 with :
2575 context : .
2676 file : ./api/Dockerfile
2777 tags : cardanofoundation/cardano-rosetta-java-api:${{ inputs.tag }}
2878 push : true
79+
2980 - name : API - Build and push Docker latest image
3081 uses : docker/build-push-action@v4
3182 if : ${{ inputs.isRelease == 'true' }}
@@ -34,13 +85,15 @@ runs:
3485 file : ./api/Dockerfile
3586 tags : cardanofoundation/cardano-rosetta-java-api:latest
3687 push : true
88+
3789 - name : Indexer - Build and push Docker ${{ inputs.tag }} image
3890 uses : docker/build-push-action@v4
3991 with :
4092 context : .
4193 file : ./yaci-indexer/Dockerfile
4294 tags : cardanofoundation/cardano-rosetta-java-indexer:${{ inputs.tag }}
4395 push : true
96+
4497 - name : Indexer - Build and push Docker latest image
4598 uses : docker/build-push-action@v4
4699 if : ${{ inputs.isRelease == 'true' }}
@@ -49,58 +102,39 @@ runs:
49102 file : ./yaci-indexer/Dockerfile
50103 tags : cardanofoundation/cardano-rosetta-java-indexer:latest
51104 push : true
105+
52106 - name : Cardano Node - Build and push Docker ${{ inputs.tag }} image
53107 uses : docker/build-push-action@v4
54108 with :
55109 context : .
56110 file : ./docker/dockerfiles/node/Dockerfile
57- tags : cardanofoundation/cardano-rosetta-java-cardano-node:${{ inputs.tag }}
58- push : true
59- - name : Cardano Node - Build and push Docker latest image
60- uses : docker/build-push-action@v4
61- if : ${{ inputs.isRelease == 'true' }}
62- with :
63- context : .
64- file : ./docker/dockerfiles/node/Dockerfile
65- tags : cardanofoundation/cardano-rosetta-java-cardano-node:latest
111+ tags : cardanofoundation/cardano-rosetta-java-cardano-node:${{ steps.envver.outputs.node_version }}
66112 push : true
113+
67114 - name : Postgres - Build and push Docker ${{ inputs.tag }} image
68115 uses : docker/build-push-action@v4
69116 with :
70117 context : .
71118 file : ./docker/dockerfiles/postgres/Dockerfile
72- tags : cardanofoundation/cardano-rosetta-java-postgres:${{ inputs.tag }}
73- push : true
74- - name : Postgres - Build and push Docker latest image
75- uses : docker/build-push-action@v4
76- if : ${{ inputs.isRelease == 'true' }}
77- with :
78- context : .
79- file : ./docker/dockerfiles/postgres/Dockerfile
80- tags : cardanofoundation/cardano-rosetta-java-postgres:latest
119+ tags : cardanofoundation/cardano-rosetta-java-postgres:${{ steps.envver.outputs.pg_version }}
81120 push : true
121+
82122 - name : Mithril - Build and push Docker ${{ inputs.tag }} image
83123 uses : docker/build-push-action@v4
84124 with :
85125 context : .
86126 file : ./docker/dockerfiles/mithril/Dockerfile
87- tags : cardanofoundation/cardano-rosetta-java-mithril:${{ inputs.tag }}
88- push : true
89- - name : Mithril - Build and push Docker latest image
90- uses : docker/build-push-action@v4
91- if : ${{ inputs.isRelease == 'true' }}
92- with :
93- context : .
94- file : ./docker/dockerfiles/mithril/Dockerfile
95- tags : cardanofoundation/cardano-rosetta-java-mithril:latest
127+ tags : cardanofoundation/cardano-rosetta-java-mithril:${{ steps.envver.outputs.mithril_version }}
96128 push : true
129+
97130 - name : All-in-one - Build and push Docker image
98131 uses : docker/build-push-action@v4
99132 with :
100133 context : .
101134 file : ./docker/Dockerfile
102135 tags : cardanofoundation/cardano-rosetta-java:${{ inputs.tag }}
103136 push : true
137+
104138 - name : All-in-one - Build and push Docker latest image
105139 uses : docker/build-push-action@v4
106140 if : ${{ inputs.isRelease == 'true' }}
0 commit comments