Skip to content
This repository was archived by the owner on Apr 10, 2024. It is now read-only.

Commit 6d0909d

Browse files
authored
chore: updated testnet & devnet (#21)
* chore: update stage * chore: updated devnet & testnet
1 parent e03228d commit 6d0909d

File tree

4 files changed

+100
-378
lines changed

4 files changed

+100
-378
lines changed

.github/workflows/deploy_ecs_stage.yaml

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,74 @@ on:
99
- main
1010

1111
env:
12-
AWS_REGION: "us-east-2"
13-
ECR_REPOSITORY: fee-oracle-stage
12+
AWS_REGION: '${{ secrets.AWS_REGION }}'
1413
ENVIRONMENT: STAGE
14+
AWS_STAGE: '${{ secrets.AWS_ARN }}'
15+
REGISTRY: 'ghcr.io'
16+
TAG: 'latest'
1517

1618
jobs:
17-
deploy:
18-
name: Deploy
19-
runs-on: ubuntu-18.04
19+
push:
20+
name: push
21+
runs-on: ubuntu-latest
2022

2123
permissions:
2224
contents: read
2325
id-token: write
2426

2527
steps:
2628
- name: checkout the source code
27-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v2
33+
34+
- name: login to ghcr
35+
id: ghcr
36+
uses: docker/login-action@v2
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ github.repository_owner }}
40+
password: ${{ secrets.GHCR_TOKEN }}
41+
42+
- name: build / tag / push docker image into ghcr
43+
id: build-and-push
44+
uses: docker/build-push-action@v3
45+
with:
46+
context: .
47+
push: true
48+
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}
49+
50+
deploy:
51+
needs: push
52+
name: deploy
53+
runs-on: ubuntu-latest
54+
55+
permissions:
56+
contents: read
57+
id-token: write
58+
59+
steps:
60+
- name: checkout the source code
61+
uses: actions/checkout@v3
62+
63+
- name: checkout ecs repo
64+
uses: actions/checkout@v3
65+
with:
66+
repository: sygmaprotocol/devops
67+
token: ${{ secrets.GHCR_TOKEN }}
2868

2969
- name: configure aws credentials
3070
uses: aws-actions/configure-aws-credentials@v1
3171
with:
32-
role-to-assume: arn:aws:iam::852551629426:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
72+
role-to-assume: arn:aws:iam::${{ env.AWS_STAGE }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
3373
aws-region: ${{ env.AWS_REGION }}
3474
role-session-name: GithubActions
3575

36-
- name: login to ecr
37-
id: ecr
38-
uses: aws-actions/amazon-ecr-login@v1
39-
40-
- name: build / tag / push docker image into ecr
41-
env:
42-
ECR_REGISTRY: ${{ steps.ecr.outputs.registry }}
43-
run: |
44-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:${{ env.ENVIRONMENT }} .
45-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:${{ env.ENVIRONMENT }}
46-
4776
- name: deploy task definition
4877
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
4978
with:
50-
task-definition: ecs/task_definition_${{ env.ENVIRONMENT }}.json
51-
service: fee-oracle-service-${{ env.ENVIRONMENT }}
52-
cluster: fee-oracle-${{ env.ENVIRONMENT }}
79+
task-definition: 'fee-oracle/ecs/task_definition_${{ env.ENVIRONMENT }}.json'
80+
service: 'fee-oracle-service-${{ env.ENVIRONMENT }}'
81+
cluster: 'fee-oracle-${{ env.ENVIRONMENT }}'
5382
wait-for-service-stability: true

.github/workflows/deploy_ecs_testnet.yaml

Lines changed: 50 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@ on:
99
- published
1010

1111
env:
12-
AWS_REGION: 'us-east-2'
13-
ECR_REPOSITORY: fee-oracle
12+
AWS_REGION: '${{ secrets.AWS_REGION }}'
1413
ENVIRONMENT: TESTNET
14+
AWS_STAGE: '${{ secrets.AWS_ARN }}'
15+
REGISTRY: 'ghcr.io'
16+
TAG: 'stable'
17+
1518

1619
jobs:
17-
deploy:
18-
name: Deploy
20+
push:
21+
name: push
1922
runs-on: ubuntu-latest
2023

2124
permissions:
@@ -24,30 +27,57 @@ jobs:
2427

2528
steps:
2629
- name: checkout the source code
27-
uses: actions/checkout@v2
30+
uses: actions/checkout@v3
31+
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v2
34+
35+
- name: login to ghcr
36+
id: ghcr
37+
uses: docker/login-action@v2
38+
with:
39+
registry: ${{ env.REGISTRY }}
40+
username: ${{ github.repository_owner }}
41+
password: ${{ secrets.GHCR_TOKEN }}
42+
43+
- name: build / tag / push docker image into ghcr
44+
id: build-and-push
45+
uses: docker/build-push-action@v3
46+
with:
47+
context: .
48+
push: true
49+
tags: ${{ env.REGISTRY }}/${{ github.repository }}:${{ env.TAG }}
50+
51+
deploy:
52+
needs: push
53+
name: deploy
54+
runs-on: ubuntu-latest
55+
56+
permissions:
57+
contents: read
58+
id-token: write
59+
60+
steps:
61+
- name: checkout the source code
62+
uses: actions/checkout@v3
63+
64+
- name: checkout ecs repo
65+
uses: actions/checkout@v3
66+
with:
67+
repository: sygmaprotocol/devops
68+
token: ${{ secrets.GHCR_TOKEN }}
2869

2970
- name: configure aws credentials
3071
uses: aws-actions/configure-aws-credentials@v1
3172
with:
32-
role-to-assume: arn:aws:iam::852551629426:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
73+
role-to-assume: arn:aws:iam::${{ env.AWS_STAGE }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
3374
aws-region: ${{ env.AWS_REGION }}
3475
role-session-name: GithubActions
3576

36-
- name: login to ecr
37-
id: ecr
38-
uses: aws-actions/amazon-ecr-login@v1
39-
40-
- name: build / tag / push docker image into ecr
41-
env:
42-
ECR_REGISTRY: ${{ steps.ecr.outputs.registry }}
43-
run: |
44-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:stable .
45-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:stable
46-
4777
- name: deploy task definition
4878
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
4979
with:
50-
task-definition: ecs/task_definition_${{ env.ENVIRONMENT }}.json
51-
service: fee-oracle-service-${{ env.ENVIRONMENT }}
52-
cluster: fee-oracle-${{ env.ENVIRONMENT }}
80+
task-definition: 'fee-oracle/ecs/task_definition_${{ env.ENVIRONMENT }}.json'
81+
service: 'fee-oracle-service-${{ env.ENVIRONMENT }}'
82+
cluster: 'fee-oracle-${{ env.ENVIRONMENT }}'
5383
wait-for-service-stability: true

0 commit comments

Comments
 (0)