Skip to content

Commit

Permalink
test: regional deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
eedygreen committed Oct 3, 2023
1 parent 3f9af8f commit 9658142
Showing 1 changed file with 50 additions and 46 deletions.
96 changes: 50 additions & 46 deletions .github/workflows/deploy_testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
release:
types:
- published
push:
branches:
- test-mumbai

env:
ENVIRONMENT: 'TESTNET'
Expand Down Expand Up @@ -54,54 +57,55 @@ jobs:
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}

deploy:
needs: push
name: deploy
runs-on: ubuntu-latest
strategy:
matrix:
relayer_id: [0, 1]
######################## region 1 ########################
# deploy:
# needs: push
# name: deploy
# runs-on: ubuntu-latest
# strategy:
# matrix:
# relayer_id: [0, 1]

permissions:
contents: read
id-token: write
# permissions:
# contents: read
# id-token: write

steps:
- name: checkout the source code
uses: actions/checkout@v3
# steps:
# - name: checkout the source code
# uses: actions/checkout@v3

- name: checkout ecs repo
uses: actions/checkout@v3
with:
repository: sygmaprotocol/devops
token: ${{ secrets.GHCR_TOKEN }}
# - name: checkout ecs repo
# uses: actions/checkout@v3
# with:
# repository: sygmaprotocol/devops
# token: ${{ secrets.GHCR_TOKEN }}

- name: render jinja2 templates to task definition json files
uses: cuchi/jinja2-action@v1.2.0
with:
template: 'relayers/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
output_file: 'relayers/ecs/task_definition-${{ matrix.relayer_id }}_${{ env.ENVIRONMENT }}.json'
data_format: json
variables: |
relayerId=${{ matrix.relayer_id }}
awsAccountId=${{ env.AWS_TESTNET }}
awsRegion=${{ secrets.AWS_REGION }}
awsEfs=${{ secrets.TESTNET_EFS_1 }}
# - name: render jinja2 templates to task definition json files
# uses: cuchi/jinja2-action@v1.2.0
# with:
# template: 'relayers/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
# output_file: 'relayers/ecs/task_definition-${{ matrix.relayer_id }}_${{ env.ENVIRONMENT }}.json'
# data_format: json
# variables: |
# relayerId=${{ matrix.relayer_id }}
# awsAccountId=${{ env.AWS_TESTNET }}
# awsRegion=${{ secrets.AWS_REGION }}
# awsEfs=${{ secrets.TESTNET_EFS_1 }}

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: GithubActions
# - name: configure aws credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
# aws-region: ${{ secrets.AWS_REGION }}
# role-session-name: GithubActions

- name: deploy task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: 'relayers/ecs/task_definition-${{ matrix.relayer_id }}_${{ env.ENVIRONMENT }}.json'
service: 'relayer-${{ matrix.relayer_id }}-service-${{ env.ENVIRONMENT }}'
cluster: 'relayer-${{ env.ENVIRONMENT }}'
wait-for-service-stability: true
# - name: deploy task definition
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: 'relayers/ecs/task_definition-${{ matrix.relayer_id }}_${{ env.ENVIRONMENT }}.json'
# service: 'relayer-${{ matrix.relayer_id }}-service-${{ env.ENVIRONMENT }}'
# cluster: 'relayer-${{ env.ENVIRONMENT }}'
# wait-for-service-stability: true

######################## region 2 ########################
# deploy_reg_2:
Expand Down Expand Up @@ -134,14 +138,14 @@ jobs:
# data_format: json
# variables: |
# relayerId=${{ matrix.relayer_id }}
# awsAccountId=${{ env.AWS_STAGE }}
# awsAccountId=${{ env.AWS_TESTNET}}
# awsRegion=${{ secrets.AWS_REGION_2 }}
# awsEfs=${{ secrets.TESTNET_EFS_2 }}

# - name: configure aws credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# role-to-assume: arn:aws:iam::${{ env.AWS_STAGE }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
# role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
# aws-region: ${{ secrets.AWS_REGION_2 }}
# role-session-name: GithubActions

Expand Down Expand Up @@ -184,14 +188,14 @@ jobs:
data_format: json
variables: |
relayerId=${{ matrix.relayer_id }}
awsAccountId=${{ env.AWS_STAGE }}
awsAccountId=${{ env.AWS_TESTNET }}
awsRegion=${{ secrets.AWS_REGION_3 }}
awsEfs=${{ secrets.TESTNET_EFS_3 }}
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ env.AWS_STAGE }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
aws-region: ${{ secrets.AWS_REGION_3 }}
role-session-name: GithubActions

Expand Down

0 comments on commit 9658142

Please sign in to comment.