@@ -61,7 +61,100 @@ jobs:
61
61
tags : ${{ steps.meta.outputs.tags }}
62
62
63
63
deploy-release :
64
+ strategy :
65
+ fail-fast : false
66
+ matrix :
67
+ environment : [ release-preprod ]
68
+ include :
69
+ - environment : release-preprod
70
+ environment_prefix : release
71
+ cardano_network : preprod
72
+ mithril_api_domain : api.mithril.network
73
+ mithril_protocol_parameters : |
74
+ {
75
+ k = 5
76
+ m = 100
77
+ phi_f = 0.65
78
+ }
79
+ mithril_signers : |
80
+ {
81
+ "1" = {
82
+ pool_id = "pool1zr907nmfsq5kalxdjju349nwg6f03lyfmcjfqcz52jf45gcgh03",
83
+ },
84
+ }
85
+ terraform_backend_bucket : hydra-terraform-admin
86
+ google_region : europe-west1
87
+ google_zone : europe-west1-b
88
+ google_machine_type : e2-highmem-2
89
+
64
90
runs-on : ubuntu-22.04
91
+
92
+ needs :
93
+ - build-push-docker
94
+
95
+ environment : ${{ matrix.environment }}
96
+
97
+ env :
98
+ GOOGLE_APPLICATION_CREDENTIALS : ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
99
+ GENESIS_SECRET_KEY : ${{ secrets.GENESIS_SECRET_KEY }}
100
+ GENESIS_VERIFICATION_KEY_URL : ${{ secrets.GENESIS_VERIFICATION_KEY_URL }}
101
+ DOCKER_IMAGE_ID : latest
102
+
103
+ defaults :
104
+ run :
105
+ working-directory : mithril-infra
106
+
65
107
steps :
66
- - name : TODO
67
- run : echo "Add terraform deployment to a release environment here"
108
+
109
+ - name : Checkout sources
110
+ uses : actions/checkout@v3
111
+
112
+ - name : Prepare service account credentials
113
+ run : |
114
+ echo '${{ env.GOOGLE_APPLICATION_CREDENTIALS}}' > ./google-application-credentials.json
115
+ chmod u+x ./assets/tools/google-credentials-public-key.sh
116
+ ./assets/tools/google-credentials-public-key.sh ./google-application-credentials.json ./assets/ssh_keys curry
117
+
118
+ - name : Prepare terraform variables
119
+ run : |
120
+ cat > ./env.variables.tfvars << EOF
121
+ environment_prefix = "${{ matrix.environment_prefix }}"
122
+ cardano_network = "${{ matrix.cardano_network }}"
123
+ google_region = "${{ matrix.google_region }}"
124
+ google_zone = "${{ matrix.google_zone }}"
125
+ google_machine_type = "${{ matrix.google_machine_type }}"
126
+ google_service_credentials_json_file = "./google-application-credentials.json"
127
+ mithril_api_domain = "${{ matrix.mithril_api_domain }}"
128
+ mithril_image_id = "${{ env.DOCKER_IMAGE_ID }}"
129
+ mithril_genesis_verification_key_url = "${{ env.GENESIS_VERIFICATION_KEY_URL }}"
130
+ mithril_genesis_secret_key = "${{ env.GENESIS_SECRET_KEY }}"
131
+ mithril_protocol_parameters = ${{ matrix.mithril_protocol_parameters }}
132
+ mithril_signers = ${{ matrix.mithril_signers }}
133
+ EOF
134
+ terraform fmt ./env.variables.tfvars
135
+ cat ./env.variables.tfvars
136
+
137
+ - name : Setup Terraform
138
+ uses : hashicorp/setup-terraform@v2
139
+ with :
140
+ terraform_wrapper : false
141
+
142
+ - name : Init Terraform
143
+ run : |
144
+ GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform init -backend-config="bucket=${{ matrix.terraform_backend_bucket }}" -backend-config="prefix=terraform/mithril-${{ matrix.environment }}"
145
+
146
+ - name : Check Terraform
147
+ run : terraform fmt -check
148
+
149
+ - name : Terraform Plan
150
+ run : |
151
+ GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform plan --var-file=./env.variables.tfvars
152
+
153
+ - name : Terraform Apply
154
+ run : |
155
+ GOOGLE_APPLICATION_CREDENTIALS=./google-application-credentials.json terraform apply -auto-approve --var-file=./env.variables.tfvars
156
+
157
+ - name : Cleanup
158
+ run : |
159
+ rm -f ./env.variables.tfvars
160
+ rm -f ./google-application-credentials.json
0 commit comments