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+ price :
14+ description : ' Sell order price (optionnel) '
1515 type : string
16- default : ' 5.9.0-v15'
17-
18- env :
19- DEPLOY_ENVIRONMENT : ${{ inputs.environment }}
16+ required : false
17+ default : ' '
18+ volume :
19+ description : ' Sell order volume (optionnel)'
20+ type : string
21+ required : false
22+ default : ' '
2023
2124jobs :
22- build-and-push :
25+ extract-tag :
2326 runs-on : ubuntu-latest
2427 outputs :
25- image-name : ${{ steps.set-outputs.outputs.image-name }}
26- image-tag : ${{ steps.set-outputs.outputs.image-tag }}
28+ clean_tag : ${{ steps.tag.outputs.clean_tag }}
2729 steps :
2830 - name : Checkout code
2931 uses : actions/checkout@v4
3032
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
33+ - name : Extract tag
34+ id : tag
4935 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
36+ echo "clean_tag=dev" | tee -a $GITHUB_OUTPUT
6537
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
38+ docker-publish :
39+ uses :
iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] 40+ needs : [extract-tag]
41+ with :
42+ image-name : ' iexechub/web3telegram-dapp'
43+ registry : ' docker.io'
44+ dockerfile : ' dapp/Dockerfile'
45+ context : ' dapp'
46+ security-scan : true
47+ security-report : ' sarif'
48+ hadolint : true
49+ push : true
50+ image-tag : ${{ needs.extract-tag.outputs.clean_tag }}
51+ secrets :
52+ username : ${{ secrets.DOCKERHUB_USERNAME }}
53+ password : ${{ secrets.DOCKERHUB_PAT }}
7154
7255 sconify :
73- needs : build-and-push
7456 uses :
iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] 57+ needs : [docker-publish, extract-tag]
7558 with :
76- image-name : ${{ needs.build-and-push.outputs.image-name }}
77- image-tag : ${{ needs.build-and-push .outputs.image-tag }}
59+ image-name : ' iexechub/web3telegram-dapp '
60+ image-tag : ${{ needs.extract-tag .outputs.clean_tag }}
7861 sconify-debug : false
7962 sconify-prod : true
8063 docker-registry : docker.io
81- sconify-version : ${{ inputs.sconify-version }}
64+ sconify-version : ' 5.9.0-v15 '
8265 binary : /usr/local/bin/node
8366 command : node /app/src/app.js
8467 host-path : |
@@ -90,41 +73,24 @@ jobs:
9073 dlopen : 1
9174 mprotect : 1
9275 secrets :
76+ docker-username : ${{ secrets.DOCKERHUB_USERNAME }}
9377 docker-password : ${{ secrets.DOCKERHUB_PAT }}
78+ scontain-username : ${{ secrets.SCONTAIN_REGISTRY_USERNAME }}
9479 scontain-password : ${{ secrets.SCONTAIN_REGISTRY_PAT }}
9580 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
11681
11782 deploy-dapp :
83+ needs : [extract-tag, sconify]
11884 runs-on : ubuntu-latest
119- needs : [build-and-push, sconify]
85+ environment : ${{ inputs.environment }}
12086 steps :
12187 - name : Checkout code
12288 uses : actions/checkout@v4
12389
12490 - name : Setup Node.js
12591 uses : actions/setup-node@v4
12692 with :
127- node-version : ' 18 .19'
93+ node-version : ' 20 .19.0 '
12894 cache : ' npm'
12995
13096 - name : Install dependencies
@@ -135,76 +101,49 @@ jobs:
135101 cd ../../deployment-dapp
136102 npm ci
137103
138- - name : Create scone fingerprint file
139- run : |
140- MRENCLAVE="${{ needs.sconify.outputs.prod-mrenclave }}"
141- echo "$MRENCLAVE" > deployment-dapp/.scone-fingerprint
142-
143104 - name : Deploy dapp contract
144105 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 }}
106+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PRIVATEKEY }}
107+ DOCKER_IMAGE_TAG : ${{ needs.sconify.outputs.prod-image-tag }}
108+ CHECKSUM : ${{ needs.sconify.outputs.prod-checksum }}
109+ FINGERPRINT : ${{ needs.sconify.outputs.prod-mrenclave }}
110+ RPC_URL : ${{ secrets.RPC_URL }}
151111 run : |
152112 cd deployment-dapp
153113 npm run deploy-dapp
154114
155115 - name : Push dapp secret
156116 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 }}
117+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PRIVATEKEY }}
118+ TELEGRAM_BOT_TOKEN : ${{ secrets.TELEGRAM_BOT_TOKEN_DEV }}
119+ RPC_URL : ${{ secrets.RPC_URL }}
162120 run : |
163121 cd deployment-dapp
164122 npm run push-dapp-secret
165123
166124 - name : Publish free sell order
167125 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'
126+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PRIVATEKEY }}
127+ PRICE : ${{ inputs.price || vars.SELL_ORDER_PRICE }}
128+ VOLUME : ${{ inputs.volume || vars.SELL_ORDER_VOLUME }}
129+ RPC_URL : ${{ secrets.RPC_URL }}
173130 run : |
174131 cd deployment-dapp
175132 npm run publish-sell-order
176133
177- - name : Add resource to whitelist (dev)
178- if : inputs.environment == 'dapp-dev'
134+ - name : Add resource to whitelist
179135 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 }}
136+ CONTRACT_ADDRESS : ${{ secrets.WEB3TELEGRAM_WHITELIST_CONTRACT_ADDRESS }}
137+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PRIVATEKEY }}
191138 run : |
192139 cd node_modules/whitelist-smart-contract
193140 export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist
194141
195142 - name : Configure ENS
143+ if : ${{ vars.DAPP_ENS_NAME }}
196144 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 }}
145+ WALLET_PRIVATE_KEY : ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PRIVATEKEY }}
146+ DAPP_ENS_NAME : ${{ vars.DAPP_ENS_NAME }}
200147 run : |
201148 cd deployment-dapp
202149 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