Skip to content

Commit 1f886a6

Browse files
authored
Merge pull request #26 from drift-labs/chore/mainnet-beta-gh-actions
mainnet-beta deploy
2 parents 00db165 + 9654607 commit 1f886a6

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed

.github/workflows/mainnet-beta.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Build Image And Deploy
2+
3+
on:
4+
push:
5+
branches: [mainnet-beta]
6+
7+
jobs:
8+
build:
9+
runs-on: ubicloud
10+
steps:
11+
- name: Checkout Code
12+
uses: actions/checkout@v3
13+
with:
14+
submodules: recursive
15+
16+
- name: Configure AWS credentials
17+
uses: aws-actions/configure-aws-credentials@master
18+
with:
19+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PROD }}
20+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_PROD }}
21+
aws-region: ${{ secrets.EKS_PROD_REGION }}
22+
23+
- name: Log in to Amazon ECR
24+
id: login-ecr
25+
uses: aws-actions/amazon-ecr-login@v2
26+
27+
- name: Build and push
28+
uses: docker/build-push-action@v6
29+
env:
30+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
31+
ECR_REPOSITORY: events-publisher
32+
IMAGE_TAG: ${{ github.sha }}
33+
BRANCH_NAME: ${{ github.ref_name }}
34+
with:
35+
context: .
36+
push: true
37+
tags: |
38+
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}-${{ env.BRANCH_NAME }}-amd64
39+
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest-${{ env.BRANCH_NAME }}-amd64
40+
41+
deploy:
42+
runs-on: ubicloud
43+
needs: [build]
44+
steps:
45+
- name: Configure AWS credentials
46+
uses: aws-actions/configure-aws-credentials@master
47+
with:
48+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PROD }}
49+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_PROD }}
50+
aws-region: ${{ secrets.EKS_PROD_REGION }}
51+
52+
- name: Install kubectl
53+
uses: azure/setup-kubectl@v3
54+
with:
55+
version: 'v1.30.0'
56+
57+
- name: Configure AWS EKS Credentials
58+
run: aws eks update-kubeconfig --name ${{ secrets.EKS_PROD_CLUSTER_NAME }} --region ${{ secrets.EKS_PROD_REGION }} --role-arn ${{ secrets.EKS_PROD_DEPLOY_ROLE }}
59+
60+
- name: Restart deployment
61+
env:
62+
BRANCH_NAME: ${{ github.ref_name }}
63+
run: |
64+
kubectl rollout restart -n $BRANCH_NAME deployment/events-publisher-app
65+
kubectl rollout restart -n $BRANCH_NAME deployment/events-ws-connection-manager-app

.github/workflows/master.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# non-prod
2+
name: Build Image And Deploy
3+
4+
on:
5+
push:
6+
branches: [master, staging]
7+
8+
jobs:
9+
build:
10+
runs-on: ubicloud
11+
steps:
12+
- name: Checkout Code
13+
uses: actions/checkout@v3
14+
with:
15+
submodules: recursive
16+
17+
- name: Configure AWS credentials
18+
uses: aws-actions/configure-aws-credentials@master
19+
with:
20+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_NON_PROD }}
21+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_NON_PROD }}
22+
aws-region: ${{ secrets.EKS_NON_PROD_REGION }}
23+
24+
- name: Log in to Amazon ECR
25+
id: login-ecr
26+
uses: aws-actions/amazon-ecr-login@v2
27+
28+
- name: Build and push
29+
uses: docker/build-push-action@v6
30+
env:
31+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
32+
ECR_REPOSITORY: events-publisher
33+
IMAGE_TAG: ${{ github.sha }}
34+
BRANCH_NAME: ${{ github.ref_name }}
35+
with:
36+
context: .
37+
push: true
38+
tags: |
39+
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}-${{ env.BRANCH_NAME }}-amd64
40+
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest-${{ env.BRANCH_NAME }}-amd64
41+
42+
deploy:
43+
runs-on: ubicloud
44+
needs: [build]
45+
steps:
46+
- name: Configure AWS credentials
47+
uses: aws-actions/configure-aws-credentials@master
48+
with:
49+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_NON_PROD }}
50+
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_NON_PROD }}
51+
aws-region: ${{ secrets.EKS_NON_PROD_REGION }}
52+
53+
- name: Install kubectl
54+
uses: azure/setup-kubectl@v3
55+
with:
56+
version: 'v1.30.0'
57+
58+
- name: Configure AWS EKS Credentials
59+
run: aws eks update-kubeconfig --name ${{ secrets.EKS_NON_PROD_CLUSTER_NAME }} --region ${{ secrets.EKS_NON_PROD_REGION }} --role-arn ${{ secrets.EKS_NON_PROD_DEPLOY_ROLE }}
60+
61+
- name: Restart deployment
62+
env:
63+
BRANCH_NAME: ${{ github.ref_name }}
64+
run: |
65+
kubectl rollout restart -n $BRANCH_NAME deployment/events-publisher-app
66+
kubectl rollout restart -n $BRANCH_NAME deployment/events-ws-connection-manager-app

0 commit comments

Comments
 (0)