|
| 1 | +name: dapp-release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'dapp-v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + extract-tag: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + clean_tag: ${{ steps.tag.outputs.clean_tag }} |
| 13 | + steps: |
| 14 | + - name: Extract tag |
| 15 | + id: tag |
| 16 | + run: | |
| 17 | + TAG=${GITHUB_REF#refs/tags/dapp-v} |
| 18 | + echo "clean_tag=${TAG}" >> $GITHUB_OUTPUT |
| 19 | +
|
| 20 | + docker-publish: |
| 21 | + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] |
| 22 | + with: |
| 23 | + image-name: 'iexechub/web3mail-dapp' |
| 24 | + registry: 'docker.io' |
| 25 | + dockerfile: 'dapp/Dockerfile' |
| 26 | + context: 'dapp' |
| 27 | + security-scan: true |
| 28 | + security-report: 'sarif' |
| 29 | + hadolint: true |
| 30 | + push: true |
| 31 | + image-tag: ${{ needs.extract-tag.outputs.clean_tag }} |
| 32 | + secrets: |
| 33 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 34 | + password: ${{ secrets.DOCKERHUB_PAT }} |
| 35 | + |
| 36 | + sconify: |
| 37 | + uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/[email protected] |
| 38 | + needs: [docker-publish] |
| 39 | + with: |
| 40 | + image-name: 'iexechub/web3mail-dapp' |
| 41 | + image-tag: ${{ needs.extract-tag.outputs.clean_tag }} |
| 42 | + sconify-debug: false |
| 43 | + sconify-prod: true |
| 44 | + docker-registry: docker.io |
| 45 | + sconify-version: '5.9.0-v15' |
| 46 | + binary: /usr/local/bin/node |
| 47 | + command: node /app/src/app.js |
| 48 | + host-path: | |
| 49 | + /etc/hosts |
| 50 | + /etc/resolv.conf |
| 51 | + binary-fs: true |
| 52 | + fs-dir: /app |
| 53 | + heap: 1G |
| 54 | + dlopen: 1 |
| 55 | + mprotect: 1 |
| 56 | + secrets: |
| 57 | + docker-username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 58 | + docker-password: ${{ secrets.DOCKERHUB_PAT }} |
| 59 | + scontain-username: ${{ secrets.SCONTAIN_REGISTRY_USERNAME }} |
| 60 | + scontain-password: ${{ secrets.SCONTAIN_REGISTRY_PAT }} |
| 61 | + scone-signing-key: ${{ secrets.SCONIFY_SIGNING_PRIVATE_KEY }} |
| 62 | + |
| 63 | + deploy-multi-env-prod: |
| 64 | + strategy: |
| 65 | + matrix: |
| 66 | + # TODO: bellecour-prod already deployed add it back for next release |
| 67 | + environment: [arbitrum-sepolia-prod, arbitrum-mainnet-prod] |
| 68 | + needs: [extract-tag, sconify] |
| 69 | + runs-on: ubuntu-latest |
| 70 | + environment: ${{ matrix.environment }} |
| 71 | + steps: |
| 72 | + - name: Checkout code |
| 73 | + uses: actions/checkout@v4 |
| 74 | + |
| 75 | + - name: Setup Node.js |
| 76 | + uses: actions/setup-node@v4 |
| 77 | + with: |
| 78 | + node-version: '20.19.0' |
| 79 | + cache: 'npm' |
| 80 | + |
| 81 | + - name: Install dependencies |
| 82 | + run: | |
| 83 | + npm ci |
| 84 | + cd node_modules/whitelist-smart-contract |
| 85 | + npm install --save-dev ts-node |
| 86 | + cd ../../deployment-dapp |
| 87 | + npm ci |
| 88 | +
|
| 89 | + - name: Deploy dapp contract |
| 90 | + env: |
| 91 | + WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} |
| 92 | + DOCKER_IMAGE_TAG: ${{ needs.sconify.outputs.prod-image-tag }} |
| 93 | + CHECKSUM: ${{ needs.sconify.outputs.prod-checksum }} |
| 94 | + FINGERPRINT: ${{ needs.sconify.outputs.prod-mrenclave }} |
| 95 | + RPC_URL: ${{ secrets.RPC_URL }} |
| 96 | + run: | |
| 97 | + cd deployment-dapp |
| 98 | + npm run deploy-dapp |
| 99 | +
|
| 100 | + - name: Push dapp secret |
| 101 | + env: |
| 102 | + WALLET_PRIVATE_KEY: ${{ secrets.WEB3TELEGRAM_DAPP_OWNER_PRIVATEKEY }} |
| 103 | + TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN_PROD }} |
| 104 | + RPC_URL: ${{ secrets.RPC_URL }} |
| 105 | + run: | |
| 106 | + cd deployment-dapp |
| 107 | + npm run push-dapp-secret |
| 108 | +
|
| 109 | + - name: Publish free sell order |
| 110 | + env: |
| 111 | + WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} |
| 112 | + PRICE: ${{ vars.SELL_ORDER_PRICE }} |
| 113 | + VOLUME: ${{ vars.SELL_ORDER_VOLUME }} |
| 114 | + run: | |
| 115 | + cd deployment-dapp |
| 116 | + npm run publish-sell-order |
| 117 | +
|
| 118 | + - name: Add resource to whitelist |
| 119 | + env: |
| 120 | + CONTRACT_ADDRESS: ${{ secrets.WEB3MAIL_WHITELIST_CONTRACT_ADDRESS }} |
| 121 | + WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} |
| 122 | + run: | |
| 123 | + cd node_modules/whitelist-smart-contract |
| 124 | + export ADDRESS_TO_ADD=$(cat ../../deployment-dapp/.app-address) && npm run addResourceToWhitelist |
| 125 | +
|
| 126 | + - name: Configure ENS |
| 127 | + if: ${{ vars.DAPP_ENS_NAME }} |
| 128 | + env: |
| 129 | + WALLET_PRIVATE_KEY: ${{ secrets.WEB3MAIL_DAPP_OWNER_PRIVATEKEY }} |
| 130 | + DAPP_ENS_NAME: ${{ vars.DAPP_ENS_NAME }} |
| 131 | + run: | |
| 132 | + cd deployment-dapp |
| 133 | + npm run configure-ens |
0 commit comments