Skip to content

Commit

Permalink
feat(ci/cd): Create Indexer-k8s-CI-CD.yml (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyfilyanin authored Nov 5, 2024
1 parent f590ff9 commit 7bf5cb9
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/Indexer-k8s-CI-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Build and Deploy Indexer Graphql and Processors for Testnet

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}

jobs:
build-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Log in to the github container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@master
with:
context: indexer
file: indexer/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-indexer:testnet

deploy-to-k8s:
needs: [build-image]
runs-on: ubuntu-latest

steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Deploy to k8s
uses: sergeyfilyanin/kubectl-aws-eks@master
with:
args: rollout restart deployment indexer-bridge-processor-eth-stg indexer-bridge-processor-gear-stg indexer-bridge-graphql-stg -n gear-bridges

- name: Check k8s deployments
uses: sergeyfilyanin/kubectl-aws-eks@master
with:
args: get deployment -o name -n vara | xargs -n1 -t kubectl rollout status -n gear-bridges --timeout=120s

0 comments on commit 7bf5cb9

Please sign in to comment.