Add arbitrum monitoring (first pass) #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and deploy Chewie docker image | |
on: | |
workflow_dispatch: # Allows manual workflow trigger | |
push: # Auto trigger on push to master | |
branches: | |
- master | |
# Set global env variables | |
env: | |
AWS_REGION: eu-west-2 | |
CLUSTER_NAME: qa-cluster | |
ECR_REPOSITORY: chewie | |
IMAGE_TAG: ${{ github.sha }} | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
jobs: | |
# # Build chewie and push to AWS ECR | |
buildAndPush: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- name: Echo Env Vars through Context | |
run: | | |
echo "$GITHUB_CONTEXT" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ${{ github.workspace }} | |
file: ./Dockerfile | |
push: true | |
tags: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
- uses: sarisia/actions-status-discord@c193626e5ce172002b8161e116aa897de7ab5383 | |
if: always() | |
with: | |
webhook: ${{ env.DISCORD_WEBHOOK }} | |
title: "Build and push" | |
deploy: | |
needs: buildAndPush | |
runs-on: ubuntu-latest | |
env: | |
NAMESPACE: chewie | |
steps: | |
- name: Configure AWS credentials for EKS | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/eks-admin | |
role-session-name: github-cicd | |
role-duration-seconds: 1200 | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Configure AWS EKS | |
run: | | |
aws eks --region ${{ env.AWS_REGION }} update-kubeconfig --name ${{ env.CLUSTER_NAME }} | |
- name: Deploy to Kubernetes cluster | |
run: | | |
kubectl set image deployment/gitbutler chewie=${{ env.RELEASE_IMAGE }} --record -n $NAMESPACE | |
env: | |
RELEASE_IMAGE: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.eu-west-2.amazonaws.com/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
- name: Validate Kubernetes deployment | |
run: | | |
kubectl rollout status deployment/gitbutler -n ${{ env.NAMESPACE }} | |
- uses: sarisia/actions-status-discord@c193626e5ce172002b8161e116aa897de7ab5383 | |
if: always() | |
with: | |
webhook: ${{ env.DISCORD_WEBHOOK }} | |
title: "Deploy Chewie" |