Skip to content

Commit

Permalink
Merge pull request #26 from drift-labs/chore/mainnet-beta-gh-actions
Browse files Browse the repository at this point in the history
mainnet-beta deploy
  • Loading branch information
jackwaller authored Dec 5, 2024
2 parents 00db165 + 9654607 commit 1f886a6
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/mainnet-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Build Image And Deploy

on:
push:
branches: [mainnet-beta]

jobs:
build:
runs-on: ubicloud
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_PROD }}
aws-region: ${{ secrets.EKS_PROD_REGION }}

- name: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push
uses: docker/build-push-action@v6
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: events-publisher
IMAGE_TAG: ${{ github.sha }}
BRANCH_NAME: ${{ github.ref_name }}
with:
context: .
push: true
tags: |
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}-${{ env.BRANCH_NAME }}-amd64
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest-${{ env.BRANCH_NAME }}-amd64
deploy:
runs-on: ubicloud
needs: [build]
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_PROD }}
aws-region: ${{ secrets.EKS_PROD_REGION }}

- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.30.0'

- name: Configure AWS EKS Credentials
run: aws eks update-kubeconfig --name ${{ secrets.EKS_PROD_CLUSTER_NAME }} --region ${{ secrets.EKS_PROD_REGION }} --role-arn ${{ secrets.EKS_PROD_DEPLOY_ROLE }}

- name: Restart deployment
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
kubectl rollout restart -n $BRANCH_NAME deployment/events-publisher-app
kubectl rollout restart -n $BRANCH_NAME deployment/events-ws-connection-manager-app
66 changes: 66 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# non-prod
name: Build Image And Deploy

on:
push:
branches: [master, staging]

jobs:
build:
runs-on: ubicloud
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_NON_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_NON_PROD }}
aws-region: ${{ secrets.EKS_NON_PROD_REGION }}

- name: Log in to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Build and push
uses: docker/build-push-action@v6
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: events-publisher
IMAGE_TAG: ${{ github.sha }}
BRANCH_NAME: ${{ github.ref_name }}
with:
context: .
push: true
tags: |
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}-${{ env.BRANCH_NAME }}-amd64
${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest-${{ env.BRANCH_NAME }}-amd64
deploy:
runs-on: ubicloud
needs: [build]
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_NON_PROD }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_KEY_NON_PROD }}
aws-region: ${{ secrets.EKS_NON_PROD_REGION }}

- name: Install kubectl
uses: azure/setup-kubectl@v3
with:
version: 'v1.30.0'

- name: Configure AWS EKS Credentials
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 }}

- name: Restart deployment
env:
BRANCH_NAME: ${{ github.ref_name }}
run: |
kubectl rollout restart -n $BRANCH_NAME deployment/events-publisher-app
kubectl rollout restart -n $BRANCH_NAME deployment/events-ws-connection-manager-app

0 comments on commit 1f886a6

Please sign in to comment.