Skip to content

Commit 98b23e9

Browse files
authored
Merge pull request #18 from sygmaprotocol/mainnet
chore: Mainnet CD Pipeline & testnet visibility of image versions
2 parents 9d773d1 + 90a8c15 commit 98b23e9

File tree

2 files changed

+80
-14
lines changed

2 files changed

+80
-14
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: RPC-Gateway Mainnet
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_tag:
7+
description: 'The Release tag Version'
8+
required: false
9+
type: string
10+
11+
12+
env:
13+
AWS_REGION: '${{ secrets.AWS_REGION }}'
14+
ENVIRONMENT: MAINNET
15+
AWS_MAINNET: '${{ secrets.AWS_MAINNET }}'
16+
REGISTRY: 'ghcr.io'
17+
18+
jobs:
19+
deploy:
20+
name: deploy
21+
runs-on: ubuntu-latest
22+
23+
permissions:
24+
contents: read
25+
id-token: write
26+
actions: write
27+
28+
steps:
29+
- name: checkout the source code
30+
uses: actions/checkout@v4
31+
32+
- name: checkout ecs repo
33+
uses: actions/checkout@v3
34+
with:
35+
repository: sygmaprotocol/devops
36+
token: ${{ secrets.GHCR_TOKEN }}
37+
ref: main
38+
39+
- name: render jinja2 templates to task definition json files
40+
uses: cuchi/[email protected]
41+
with:
42+
template: 'proxy_gateway/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
43+
output_file: 'proxy_gateway/ecs/task_definition-${{ env.ENVIRONMENT }}.json'
44+
data_format: json
45+
variables: |
46+
awsAccountId=${{ env.AWS_MAINNET }}
47+
awsRegion=${{ env.AWS_REGION }}
48+
awsEnv=${{ env.ENVIRONMENT }}
49+
imageTag=${{ inputs.release_tag }}
50+
51+
- name: Configure AWS Credentials
52+
uses: aws-actions/configure-aws-credentials@v4
53+
with:
54+
role-to-assume: arn:aws:iam::${{ env.AWS_MAINNET }}:role/github-actions-${{ env.ENVIRONMENT }}-sygma
55+
aws-region: ${{ env.AWS_REGION }}
56+
role-session-name: GithubActions
57+
58+
- name: Deploy to Amazon ECS
59+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
60+
with:
61+
task-definition: 'proxy_gateway/ecs/task_definition-${{ env.ENVIRONMENT }}.json'
62+
service: rpc-service-${{ env.ENVIRONMENT }}
63+
cluster: relayer-${{ env.ENVIRONMENT }}
64+
wait-for-service-stability: true
65+
66+
- name: slack notify
67+
uses: 8398a7/action-slack@v3
68+
with:
69+
status: ${{ job.status }}
70+
fields: repo,message,commit,author,action,job,eventName,ref,workflow
71+
env:
72+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
73+
if: always()

.github/workflows/gateway_testnet.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525

2626
steps:
2727
- name: checkout source code
28-
uses: actions/checkout@v3
28+
uses: actions/checkout@v4
2929

3030
- name: Set up Docker Buildx
31-
uses: docker/setup-buildx-action@v2
31+
uses: docker/setup-buildx-action@v3
3232

3333
- name: login to ghcr
3434
id: ghcr
35-
uses: docker/login-action@v2
35+
uses: docker/login-action@v3
3636
with:
3737
registry: ${{ env.REGISTRY }}
3838
username: ${{ github.repository_owner }}
@@ -44,15 +44,7 @@ jobs:
4444
with:
4545
context: .
4646
push: true
47-
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}
48-
49-
- name: tag version / push docker image into ghcr
50-
id: build-and-push-ref
51-
uses: docker/build-push-action@v3
52-
with:
53-
context: .
54-
push: true
55-
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}
47+
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }},${{ env.REGISTRY }}/${{ github.repository }}:${{ github.ref_name }}
5648

5749
- name: slack notify
5850
uses: 8398a7/action-slack@v3
@@ -75,7 +67,7 @@ jobs:
7567

7668
steps:
7769
- name: checkout ecs repo
78-
uses: actions/checkout@v3
70+
uses: actions/checkout@v4
7971
with:
8072
repository: sygmaprotocol/devops
8173
token: ${{ secrets.GHCR_TOKEN }}
@@ -90,9 +82,10 @@ jobs:
9082
awsAccountId=${{ env.AWS_TESTNET }}
9183
awsRegion=${{ secrets.AWS_REGION }}
9284
awsEfs=${{ secrets.TESTNET_RPC_EFS }}
85+
imageTag=${{ github.ref_name }}
9386
9487
- name: configure aws credentials
95-
uses: aws-actions/configure-aws-credentials@v1
88+
uses: aws-actions/configure-aws-credentials@v4
9689
with:
9790
role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
9891
aws-region: ${{ secrets.AWS_REGION }}

0 commit comments

Comments
 (0)