Deploy branch environment to EKS #25
Workflow file for this run
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: Deploy To EKS | |
on: | |
workflow_dispatch: | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
EASI_APP_NODE_VERSION: "18.20.4" | |
GIT_HASH: ${{ github.sha }} | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
GIT_REF_NAME: ${{ github.ref }} | |
jobs: | |
build_easi-frontend_image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4.0.2 | |
with: | |
role-to-assume: ${{ secrets.AWS_INFRA_OIDC_ROLE_TO_ASSUME }} | |
aws-region: us-west-2 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set env vars with direnv # This allows docker build of FE files to pull from .envrc | |
uses: HatsuneMiku3939/direnv-action@v1 | |
- name: Calculate build args | |
id: calculate-build-args | |
run: | | |
env | grep VITE_ | |
echo "VITE_LD_CLIENT_ID=${VITE_LD_CLIENT_ID}" >> $GITHUB_OUTPUT | |
echo "VITE_OKTA_CLIENT_ID=${VITE_OKTA_CLIENT_ID}" >> $GITHUB_OUTPUT | |
echo "VITE_OKTA_SERVER_ID=${VITE_OKTA_SERVER_ID}" >> $GITHUB_OUTPUT | |
echo "VITE_OKTA_ISSUER=${VITE_OKTA_ISSUER}" >> $GITHUB_OUTPUT | |
echo "VITE_OKTA_DOMAIN=${VITE_OKTA_DOMAIN}" >> $GITHUB_OUTPUT | |
echo "VITE_OKTA_REDIRECT_URI=${VITE_OKTA_REDIRECT_URI}" >> $GITHUB_OUTPUT | |
- name: Build, tag, and push image to Amazon ECR | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: Dockerfile.frontend_k8s | |
push: true | |
cache-to: type=gha,mode=max,scope=${{ env.GIT_REF_NAME }}-easi-frontend | |
cache-from: type=gha,scope=${{ env.GIT_REF_NAME }}-easi-frontend | |
tags: ${{ steps.login-ecr.outputs.registry }}/easi-frontend:${{ env.GIT_HASH }} | |
build-args: | | |
VITE_LD_CLIENT_ID=${{ steps.calculate-build-args.outputs.VITE_LD_CLIENT_ID }} | |
VITE_OKTA_CLIENT_ID=${{ steps.calculate-build-args.outputs.VITE_OKTA_CLIENT_ID }} | |
VITE_OKTA_SERVER_ID=${{ steps.calculate-build-args.outputs.VITE_OKTA_SERVER_ID }} | |
VITE_OKTA_ISSUER=${{ steps.calculate-build-args.outputs.VITE_OKTA_ISSUER }} | |
VITE_OKTA_DOMAIN=${{ steps.calculate-build-args.outputs.VITE_OKTA_DOMAIN }} | |
VITE_OKTA_REDIRECT_URI=${{ steps.calculate-build-args.outputs.VITE_OKTA_REDIRECT_URI }} | |
- name: Announce failure | |
if: ${{ failure() }} | |
run: | | |
./scripts/github-action-announce-broken-branch | |
Build_Application_Images: | |
uses: ./.github/workflows/build_application_images.yml | |
secrets: inherit | |
Deploy_to_EKS: | |
needs: [build_easi-frontend_image, Build_Application_Images] | |
runs-on: ubuntu-latest | |
environment: "dev" | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4.0.2 | |
with: | |
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }} | |
aws-region: us-west-2 | |
- name: Update kubeconfig | |
run: aws eks update-kubeconfig --name dev-easi-poc-cluster --region us-west-2 | |
- name: Deploy to EKS | |
run: | | |
./scripts/deploy_eks_env.sh |