1- name : Deploy DApp Contract
1+ name : deploy-dapp
22
33on :
44 workflow_dispatch :
88 required : true
99 type : choice
1010 options :
11- - dapp-dev
12- - dapp-prod
13- sconify-version :
14- description : ' Version of the sconify image to use'
11+ - bellecour-dev
12+ - arbitrum-sepolia-dev
13+ - arbitrum-mainnet-dev
14+ price :
15+ description : ' Sell order price (optionnel)'
1516 type : string
16- default : ' 5.9.0-v15'
17-
18- env :
19- DEPLOY_ENVIRONMENT : ${{ inputs.environment }}
17+ required : false
18+ default : ' '
19+ volume :
20+ description : ' Sell order volume (optionnel)'
21+ type : string
22+ required : false
23+ default : ' '
2024
2125jobs :
22- build-and-push :
26+ extract-tag :
2327 runs-on : ubuntu-latest
2428 outputs :
25- image-name : ${{ steps.set-outputs.outputs.image-name }}
26- image-tag : ${{ steps.set-outputs.outputs.image-tag }}
29+ clean_tag : ${{ steps.tag.outputs.clean_tag }}
2730 steps :
2831 - name : Checkout code
2932 uses : actions/checkout@v4
3033
31- - name : Set up Docker Buildx
32- uses : docker/setup-buildx-action@v3
33-
34- - name : Login to DockerHub
35- uses : docker/login-action@v3
36- with :
37- username : ${{ secrets.DOCKERHUB_USERNAME }}
38- password : ${{ secrets.DOCKERHUB_PAT }}
39-
40- - name : Get dapp version
41- id : version
42- run : |
43- VERSION=$(node -p "require('./dapp/package.json').version")
44- echo "version=$VERSION" >> $GITHUB_OUTPUT
45- echo "dapp-version=$VERSION"
46-
47- - name : Set image tag
48- id : image-tag
34+ - name : Extract tag
35+ id : tag
4936 run : |
50- if [ "${{ inputs.environment }}" = "dapp-dev" ]; then
51- echo "image-tag=dev-${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
52- else
53- echo "image-tag=${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT
54- fi
55-
56- - name : Build and push Docker image
57- id : build
58- uses : docker/build-push-action@v5
59- with :
60- context : ./dapp
61- push : true
62- tags : iexechub/web3telegram-dapp:${{ steps.image-tag.outputs.image-tag }}
63- cache-from : type=gha
64- cache-to : type=gha,mode=max
37+ echo "clean_tag=dev" | tee -a $GITHUB_OUTPUT
6538
66- - name : Set outputs
67- id : set-outputs
68- run : |
69- echo "image-name=iexechub/web3telegram-dapp" >> $GITHUB_OUTPUT
70- echo "image-tag=${{ steps.image-tag.outputs.image-tag }}" >> $GITHUB_OUTPUT
39+ docker-publish :
40+ uses :
iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] 41+ needs : [extract-tag]
42+ with :
43+ image-name : ' iexechub/web3mail-dapp'
44+ registry : ' docker.io'
45+ dockerfile : ' dapp/Dockerfile'
46+ context : ' dapp'
47+ security-scan : true
48+ security-report : ' sarif'
49+ hadolint : true
50+ push : true
51+ image-tag : ${{ needs.extract-tag.outputs.clean_tag }}
52+ secrets :
53+ username : ${{ secrets.DOCKERHUB_USERNAME }}
54+ password : ${{ secrets.DOCKERHUB_PAT }}
7155
7256 sconify :
73- needs : build-and-push
7457 uses :
iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] 58+ needs : [docker-publish, extract-tag]
7559 with :
76- image-name : ${{ needs.build-and-push.outputs.image-name }}
77- image-tag : ${{ needs.build-and-push .outputs.image-tag }}
60+ image-name : ' iexechub/web3mail-dapp '
61+ image-tag : ${{ needs.extract-tag .outputs.clean_tag }}
7862 sconify-debug : false
7963 sconify-prod : true
8064 docker-registry : docker.io
81- sconify-version : ${{ inputs.sconify-version }}
65+ sconify-version : ' 5.9.0-v15 '
8266 binary : /usr/local/bin/node
8367 command : node /app/src/app.js
8468 host-path : |
@@ -90,41 +74,24 @@ jobs:
9074 dlopen : 1
9175 mprotect : 1
9276 secrets :
77+ docker-username : ${{ secrets.DOCKERHUB_USERNAME }}
9378 docker-password : ${{ secrets.DOCKERHUB_PAT }}
79+ scontain-username : ${{ secrets.SCONTAIN_REGISTRY_USERNAME }}
9480 scontain-password : ${{ secrets.SCONTAIN_REGISTRY_PAT }}
9581 scone-signing-key : ${{ secrets.SCONIFY_SIGNING_PRIVATE_KEY }}
96- docker-username : ${{ secrets.DOCKERHUB_USERNAME }}
97- scontain-username : ${{ secrets.SCONTAIN_REGISTRY_USERNAME }}
98-
99- display-sconify-results :
100- runs-on : ubuntu-latest
101- needs : sconify
102- steps :
103- - name : Display Sconify Results
104- run : |
105- echo "## Sconify Results" >> $GITHUB_STEP_SUMMARY
106- echo "" >> $GITHUB_STEP_SUMMARY
107-
108- echo "### Production Image" >> $GITHUB_STEP_SUMMARY
109- echo "- **Image Tag**: ${{ needs.sconify.outputs.prod-image-tag }}" >> $GITHUB_STEP_SUMMARY
110- echo "- **Checksum**: ${{ needs.sconify.outputs.prod-checksum }}" >> $GITHUB_STEP_SUMMARY
111- echo "- **MrEnclave**: ${{ needs.sconify.outputs.prod-mrenclave }}" >> $GITHUB_STEP_SUMMARY
112- echo "" >> $GITHUB_STEP_SUMMARY
113-
114- echo "### Summary" >> $GITHUB_STEP_SUMMARY
115- echo "Sconification completed successfully!" >> $GITHUB_STEP_SUMMARY
11682
11783 deploy-dapp :
84+ needs : [extract-tag, sconify]
11885 runs-on : ubuntu-latest
119- needs : [build-and-push, sconify]
86+ environment : ${{ inputs.environment }}
12087 steps :
12188 - name : Checkout code
12289 uses : actions/checkout@v4
12390
12491 - name : Setup Node.js
12592 uses : actions/setup-node@v4
12693 with :
127- node-version : ' 18 .19'
94+ node-version : ' 20 .19.0 '
12895 cache : ' npm'
12996
13097 - name : Install dependencies
@@ -135,76 +102,49 @@ jobs:
135102 cd ../../deployment-dapp
136103 npm ci
137104
138- - name : Create scone fingerprint file
139- run : |
140- MRENCLAVE="${{ needs.sconify.outputs.prod-mrenclave }}"
141- echo "$MRENCLAVE" > deployment-dapp/.scone-fingerprint
142-
143105 - name : Deploy dapp contract
144106 env :
145- DEPLOY_ENVIRONMENT : ${{ inputs.environment }}
146- WALLET_PRIVATE_KEY_DEV : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }}
147- WALLET_PRIVATE_KEY_PROD : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }}
148- DOCKER_IMAGE_CHECKSUM_DEV : ${{ needs.sconify.outputs.prod-checksum }}
149- DOCKER_IMAGE_CHECKSUM_PROD : ${{ needs.sconify.outputs.prod-checksum }}
150- SCONIFIED_IMAGE_TAG : ${{ needs.sconify.outputs.prod-image-tag }}
107+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }}
108+ DOCKER_IMAGE_TAG : ${{ needs.sconify.outputs.prod-image-tag }}
109+ CHECKSUM : ${{ needs.sconify.outputs.prod-checksum }}
110+ FINGERPRINT : ${{ needs.sconify.outputs.prod-mrenclave }}
111+ RPC_URL : ${{ secrets.RPC_URL }}
151112 run : |
152113 cd deployment-dapp
153114 npm run deploy-dapp
154115
155116 - name : Push dapp secret
156117 env :
157- DEPLOY_ENVIRONMENT : ${{ inputs.environment }}
158- WALLET_PRIVATE_KEY_DEV : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }}
159- WALLET_PRIVATE_KEY_PROD : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }}
160- TELEGRAM_BOT_TOKEN_DEV : ${{ secrets.TELEGRAM_BOT_TOKEN_DEV }}
161- TELEGRAM_BOT_TOKEN_PROD : ${{ secrets.TELEGRAM_BOT_TOKEN_PROD }}
118+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PRIVATEKEY }}
119+ TELEGRAM_BOT_TOKEN : ${{ secrets.TELEGRAM_BOT_TOKEN_DEV }}
120+ RPC_URL : ${{ secrets.RPC_URL }}
162121 run : |
163122 cd deployment-dapp
164123 npm run push-dapp-secret
165124
166125 - name : Publish free sell order
167126 env :
168- DEPLOY_ENVIRONMENT : ${{ inputs.environment }}
169- WALLET_PRIVATE_KEY_DEV : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }}
170- WALLET_PRIVATE_KEY_PROD : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }}
171- PRICE : ' 0'
172- VOLUME : ' 1000000000'
127+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }}
128+ PRICE : ${{ inputs.price || vars.SELL_ORDER_PRICE }}
129+ VOLUME : ${{ inputs.volume || vars.SELL_ORDER_VOLUME }}
130+ RPC_URL : ${{ secrets.RPC_URL }}
173131 run : |
174132 cd deployment-dapp
175133 npm run publish-sell-order
176134
177- - name : Add resource to whitelist (dev)
178- if : inputs.environment == 'dapp-dev'
135+ - name : Add resource to whitelist
179136 env :
180- WALLET_PRIVATE_KEY : ${{ secrets.DEPLOYER_DEV_PRIVATEKEY }}
181- CONTRACT_ADDRESS : ${{ secrets.WEB3TELEGRAM_WHITELIST_DEV_ADDRESS }}
182- run : |
183- cd node_modules/whitelist-smart-contract
184- export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist
185-
186- - name : Add resource to whitelist (prod)
187- if : inputs.environment == 'dapp-prod'
188- env :
189- WALLET_PRIVATE_KEY : ${{ secrets.DEPLOYER_PROD_PRIVATEKEY }}
190- CONTRACT_ADDRESS : ${{ secrets.WEB3TELEGRAM_WHITELIST_PROD_ADDRESS }}
137+ CONTRACT_ADDRESS : ${{ secrets.WEB3MAIL_WHITELIST_CONTRACT_ADDRESS }}
138+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }}
191139 run : |
192140 cd node_modules/whitelist-smart-contract
193141 export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist
194142
195143 - name : Configure ENS
144+ if : ${{ vars.DAPP_ENS_NAME }}
196145 env :
197- DEPLOY_ENVIRONMENT : ${{ inputs.environment }}
198- WALLET_PRIVATE_KEY_DEV : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_DEV_PRIVATEKEY }}
199- WALLET_PRIVATE_KEY_PROD : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PROD_PRIVATEKEY }}
146+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }}
147+ DAPP_ENS_NAME : ${{ vars.DAPP_ENS_NAME }}
200148 run : |
201149 cd deployment-dapp
202150 npm run configure-ens
203-
204- - name : Upload deployment artifacts
205- uses : actions/upload-artifact@v4
206- with :
207- name : deployment-artifacts
208- path : |
209- deployment-dapp/.app-address
210- deployment-dapp/.scone-fingerprint
0 commit comments