Skip to content

Update main.rs

Update main.rs #3

Workflow file for this run

name: Build and Deploy Backend & Frontend to k8s
on:
push:
branches: ['master']
workflow_dispatch:
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 }}
KUBE_NAMESPACE: substrate-telemetry
KUBE_DEPLOYMENT: telemetry-fullstack
jobs:
build-and-push-backend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the 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: backend
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-backend
build-and-push-frontend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the 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: frontend
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend
deploy-to-k8s-aws:
needs: [build-and-push-backend, build-and-push-frontend]
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 $KUBE_DEPLOYMENT -n $KUBE_NAMESPACE