-
Notifications
You must be signed in to change notification settings - Fork 71
73 lines (63 loc) · 2.66 KB
/
mainnet-beta.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: KeeperBots Build Image And Deploy
on:
push:
branches: [mainnet-beta]
workflow_dispatch:
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: keeper-bots-v2
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 get deployments -n $BRANCH_NAME -o name | grep filler | xargs -I {} kubectl rollout restart {} -n $BRANCH_NAME
kubectl rollout restart -n $BRANCH_NAME deployment/funding-rate-updater-bot
kubectl rollout restart -n $BRANCH_NAME deployment/liquidator-global-bot
kubectl rollout restart -n $BRANCH_NAME deployment/liquidator-global-2-bot
kubectl rollout restart -n $BRANCH_NAME deployment/user-lp-settler-bot
kubectl rollout restart -n $BRANCH_NAME deployment/user-pnl-settler-bot
kubectl rollout restart -n $BRANCH_NAME deployment/pyth-cranker-bot
kubectl rollout restart -n $BRANCH_NAME deployment/switchboard-cranker-bot