Skip to content

Deploy verifier backend to AWS Environment new account #33

Deploy verifier backend to AWS Environment new account

Deploy verifier backend to AWS Environment new account #33

name: Deploy verifier backend to AWS Environment new account
on:
workflow_run:
workflows: ["Checks"]
branches: ["develop", "main"]
types:
- completed
env:
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
ECR_REPOSITORY: verifier_backend
POLYGON_AMOY_CONTRACT_ADDRESS: "0x1a4cC30f2aA0377b0c3bc9848766D90cb4404124"
POLYGON_AMOY_SENDER_DID: "did:iden3:polygon:amoy:xCkXubP2T1zsUQpFLwczwfbWpdBYBxmJDtUTWAUCE"
POLYGON_AMOY_CHAIN_ID: "80002"
POLYGON_MAIN_CONTRACT_ADDRESS: "0x624ce98D2d27b20b8f8d521723Df8fC4db71D79D"
POLYGON_MAIN_SENDER_DID: "did:polygonid:polygon:main:2q4Q7F7tM1xpwUTgWivb6TgKX3vWirsE3mqymuYjVv"
POLYGON_MAIN_CHAIN_ID: "137"
POLYGON_ZKEVM_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
POLYGON_ZKEVM_MAIN_SENDER_DID: "did:iden3:polygon:zkevm:xJa94Ky3oeawnDdQVoTotncYnBA1fCLW6C4NZVpRu"
POLYGON_ZKEVM_MAIN_CHAIN_ID: "1101"
POLYGON_ZKEVM_CARDONA_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
POLYGON_ZKEVM_CARDONA_SENDER_DID: "did:iden3:polygon:cardona:xWCCEr5ycUDRWQp3Zu6UJvyUuGsEUpwfenMQXixEj"
POLYGON_ZKEVM_CARDONA_CHAIN_ID: "2442"
PRIVADO_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
PRIVADO_MAIN_SENDER_DID: "did:iden3:privado:main:2SZz8Kvfb6CXGTiiqNiz8CTFTnySV7PKN7iVUvsNMH"
PRIVADO_MAIN_CHAIN_ID: "21000"
PRIVADO_TEST_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
PRIVADO_TEST_SENDER_DID: "did:iden3:privado:test:2Sn9bnRFiTYNfbS1dVTaGCUXuMfnQMUcTCAXtFv4Gr"
PRIVADO_TEST_CHAIN_ID: "21001"
LINEA_SEPOLIA_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
LINEA_SEPOLIA_SENDER_DID: "did:iden3:linea:sepolia:28itzVLBHnMJV8sdjyffcAtWCx8HZ7btdKXxs7fJ6v"
LINEA_SEPOLIA_CHAIN_ID: "59141"
LINEA_SEPOLIA_METHOD: "iden3"
LINEA_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
LINEA_MAIN_SENDER_DID: "did:iden3:linea:main:28vX3frJDbAvHLSMHEwxuxRk1GPpjBeUEsXdAwVxDm"
LINEA_MAIN_CHAIN_ID: "59144"
LINEA_MAIN_METHOD: "iden3"
ETHEREUM_SEPOLIA_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
ETHEREUM_SEPOLIA_SENDER_DID: "did:iden3:eth:sepolia:21Jtxn7kxuy27h7NzZFwk8x2YcepKyfRyX4Tt6tqYK"
ETHEREUM_SEPOLIA_NODE_URL: "https://rpc.sepolia.org"
ETHEREUM_SEPOLIA_CHAIN_ID: "11155111"
ETHEREUM_SEPOLIA_METHOD: "iden3"
ETHEREUM_MAIN_CONTRACT_ADDRESS: "0x3C9acB2205Aa72A05F6D77d708b5Cf85FCa3a896"
ETHEREUM_MAIN_SENDER_DID: "did:iden3:eth:main:zuerR5X7JKmAEj1iR4gRJfJgNTPtLQDePsspASZvf"
ETHEREUM_MAIN_NODE_URL: "https://eth-mainnet.g.alchemy.com/v2/demo"
ETHEREUM_MAIN_CHAIN_ID: "1"
ETHEREUM_MAIN_METHOD: "iden3"
jobs:
build-backend:
environment:
name: ${{ github.event.workflow_run.head_branch }}
name: Build and push latest image to AWS
permissions:
id-token: write
contents: write
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.20"
- uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Print Environment
run: echo ${{ github.event.workflow_run.head_branch }}
- name: Build file with supported networks
run: |
echo -e "polygon:" > resolvers_settings.yaml
echo -e " amoy:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_AMOY_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_AMOY_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_AMOY_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_AMOY_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_MAINET_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " zkevm:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_ZKEVM_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_ZKEVM_MAIN_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_ZKEVM_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_ZKEVM_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " cardona:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.POLYGON_ZKEVM_CARDONA_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.POLYGON_ZKEVM_CARDONA_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.POLYGON_ZKEVM_CARDONA_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.POLYGON_ZKEVM_CARDONA_SENDER_DID }}" >> resolvers_settings.yaml
echo -e "linea:" >> resolvers_settings.yaml
echo -e " sepolia:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.LINEA_SEPOLIA_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.LINEA_SEPOLIA_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.LINEA_SEPOLIA_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.LINEA_SEPOLIA_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " method: ${{ env.LINEA_SEPOLIA_METHOD }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.LINEA_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.LINEA_MAIN_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.LINEA_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.LINEA_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " method: ${{ env.LINEA_MAIN_METHOD }}" >> resolvers_settings.yaml
echo -e "privado:" >> resolvers_settings.yaml
echo -e " test:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.PRIVADO_TEST_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_TEST_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.PRIVADO_TEST_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.PRIVADO_TEST_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.PRIVADO_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.PRIVADO_MAINET_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.PRIVADO_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.PRIVADO_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
echo -e "ethereum:" >> resolvers_settings.yaml
echo -e " sepolia:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.ETHEREUM_SEPOLIA_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.ETHEREUM_SEPOLIA_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.ETHEREUM_SEPOLIA_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.ETHEREUM_SEPOLIA_SENDER_DID }}" >> resolvers_settings.yaml
echo -e " main:" >> resolvers_settings.yaml
echo -e " contractAddress: ${{ env.ETHEREUM_MAIN_CONTRACT_ADDRESS }}" >> resolvers_settings.yaml
echo -e " networkURL: ${{ secrets.ETHEREUM_MAIN_NODE_URL }}" >> resolvers_settings.yaml
echo -e " chainID: ${{ env.ETHEREUM_MAIN_CHAIN_ID }}" >> resolvers_settings.yaml
echo -e " did: ${{ env.ETHEREUM_MAIN_SENDER_DID }}" >> resolvers_settings.yaml
cat resolvers_settings.yaml
- run: make build/docker
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID_NEW }}
with:
aws-region: ${{ env.AWS_DEFAULT_REGION }}
role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/PolygonIDActionsRole
role-session-name: GitHubActionsSession
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
id: login-ecr
- name: Get version
run: echo "::set-output name=VERSION::$(git rev-parse --short HEAD)"
id: version
- name: Tag and push image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }}
IMAGE_TAG: ${{ steps.version.outputs.VERSION }}
run: |
docker tag polygonid/verifier-backend:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}
docker tag polygonid/verifier-backend:${{ env.IMAGE_TAG }} ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest
docker push ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest