Skip to content

feat(evm-bridge): add sentry support (#75) #60

feat(evm-bridge): add sentry support (#75)

feat(evm-bridge): add sentry support (#75) #60

name: Deploy IOTA EVM Bridge
on:
push:
branches:
- develop
workflow_dispatch:
inputs:
deploy_type:
description: "Deployment type"
required: true
type: choice
options:
- staging
- rc
- production
env:
VERCEL_PROJECT_ID: ${{ secrets.EVM_BRIDGE_VERCEL_PROJECT_ID }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VITE_EVM_BRIDGE_CONFIG: ${{ secrets.EVM_BRIDGE_CONFIG }}
SENTRY_AUTH_TOKEN: ${{ secrets.TOOLING_SENTRY_AUTH_TOKEN }}
jobs:
resolve-deploy-type:
runs-on: ubuntu-latest
outputs:
deploy_type: ${{ steps.resolve.outputs.deploy_type }}
environment: ${{ steps.resolve.outputs.environment }}
apps_backend_secret: ${{ steps.resolve.outputs.apps_backend_secret }}
mainnet_url: ${{ steps.resolve.outputs.mainnet_url }}
testnet_url: ${{ steps.resolve.outputs.testnet_url }}
steps:
- name: Resolve deploy type
id: resolve
run: |
DEPLOY_TYPE="${{ inputs.deploy_type || 'staging' }}"
case "$DEPLOY_TYPE" in
staging)
echo "deploy_type=staging" >> "$GITHUB_OUTPUT"
echo "environment=Staging – evm-bridge" >> "$GITHUB_OUTPUT"
echo "apps_backend_secret=STAGING_APPS_BACKEND" >> "$GITHUB_OUTPUT"
;;
rc)
echo "deploy_type=rc" >> "$GITHUB_OUTPUT"
echo "environment=RC – evm-bridge" >> "$GITHUB_OUTPUT"
echo "apps_backend_secret=RC_APPS_BACKEND" >> "$GITHUB_OUTPUT"
;;
production)
echo "deploy_type=production" >> "$GITHUB_OUTPUT"
echo "environment=Production – evm-bridge" >> "$GITHUB_OUTPUT"
echo "apps_backend_secret=PROD_APPS_BACKEND" >> "$GITHUB_OUTPUT"
;;
esac
if [ "$DEPLOY_TYPE" = "production" ]; then
echo "mainnet_url=https://evm-bridge.iota.org" >> "$GITHUB_OUTPUT"
echo "testnet_url=https://testnet.evm-bridge.iota.org" >> "$GITHUB_OUTPUT"
else
echo "mainnet_url=https://evm-bridge-${DEPLOY_TYPE}-iota1.vercel.app" >> "$GITHUB_OUTPUT"
echo "testnet_url=https://testnet-evm-bridge-${DEPLOY_TYPE}-iota1.vercel.app" >> "$GITHUB_OUTPUT"
fi
deploy:
needs: resolve-deploy-type
permissions:
contents: read
environment: ${{ needs.resolve-deploy-type.outputs.environment }}
runs-on: ubuntu-latest
env:
APPS_BACKEND: ${{ secrets[needs.resolve-deploy-type.outputs.apps_backend_secret] }}
strategy:
fail-fast: false
matrix:
network: [mainnet, testnet]
steps:
- name: Set deployment variables
run: |
DEPLOY_TYPE="${{ needs.resolve-deploy-type.outputs.deploy_type }}"
NETWORK="${{ matrix.network }}"
echo "DEPLOY_TYPE=${DEPLOY_TYPE}" >> "$GITHUB_ENV"
if [ "$NETWORK" = "mainnet" ]; then
echo "VITE_EVM_BRIDGE_DEFAULT_NETWORK=${{ secrets.EVM_BRIDGE_PROD_DEFAULT_NETWORK }}" >> "$GITHUB_ENV"
else
echo "VITE_EVM_BRIDGE_DEFAULT_NETWORK=${{ secrets.EVM_BRIDGE_PROD_TESTNET_DEFAULT_NETWORK }}" >> "$GITHUB_ENV"
fi
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Install Nodejs
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # pin@v4.0.2
with:
node-version: "24"
cache: "pnpm"
- name: Install Vercel CLI
run: pnpm add --global vercel@canary
- name: Install Project Dependencies
run: pnpm install --frozen-lockfile
- name: Pull Vercel Environment and Deploy
run: |
VERCEL_FLAGS="--token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_SCOPE }}"
if [ "$DEPLOY_TYPE" = "production" ]; then
if [ "${{ matrix.network }}" = "mainnet" ]; then
VERCEL_ENV="production"
else
VERCEL_ENV="production-testnet"
fi
else
VERCEL_ENV="preview"
fi
echo "Deploy type: ${DEPLOY_TYPE}, Network: ${{ matrix.network }}, Vercel environment: ${VERCEL_ENV}"
vercel pull --yes --environment="$VERCEL_ENV" $VERCEL_FLAGS
if [ "$DEPLOY_TYPE" = "production" ]; then
if [ "${{ matrix.network }}" = "mainnet" ]; then
vercel build --prod $VERCEL_FLAGS
vercel deploy --prod --prebuilt $VERCEL_FLAGS
else
vercel build --target=production-testnet $VERCEL_FLAGS
vercel deploy --prebuilt --target=production-testnet $VERCEL_FLAGS
fi
else
vercel build $VERCEL_FLAGS
DEPLOY_URL=$(vercel deploy --prebuilt $VERCEL_FLAGS)
ALIAS_PREFIX=""
if [ "${{ matrix.network }}" = "testnet" ]; then
ALIAS_PREFIX="testnet-"
fi
vercel alias "$DEPLOY_URL" "${ALIAS_PREFIX}evm-bridge-${DEPLOY_TYPE}-iota1.vercel.app" $VERCEL_FLAGS
fi
notify:
needs: [resolve-deploy-type, deploy]
if: always() && needs.deploy.result != 'skipped' && (needs.resolve-deploy-type.outputs.deploy_type == 'rc' || needs.resolve-deploy-type.outputs.deploy_type == 'production')
uses: ./.github/workflows/_slack_notify.yml
secrets: inherit
with:
status: ${{ needs.deploy.result == 'success' && 'success' || 'failure' }}
title: "EVM Bridge ${{ needs.resolve-deploy-type.outputs.deploy_type }} deploy ${{ needs.deploy.result }}"
message: |
Environment: ${{ needs.resolve-deploy-type.outputs.deploy_type }}
Mainnet URL: ${{ needs.resolve-deploy-type.outputs.mainnet_url }}
Testnet URL: ${{ needs.resolve-deploy-type.outputs.testnet_url }}
Workflow Run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}