Skip to content

Refactor 2 electric boogaloo (#54) #50

Refactor 2 electric boogaloo (#54)

Refactor 2 electric boogaloo (#54) #50

# This is a basic workflow to help you get started with Actions
name: CLIENT_ADR_PUSH
# Controls when the workflow will run
on:
push:
branches:
- main
paths:
- ".github/workflows/client_adr_push.yml"
- "client/**"
- "config/client/**"
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# deployment
client_deployment:
# The type of runner that the job will run on
runs-on: ubuntu-latest
env:
REACT_APP_CLIENT_TOKEN: ${{ secrets.CLIENT_TOKEN }}
REACT_APP_COMBAT_API_URL: "https://bff.adr.7cav.us/roster/combat"
REACT_APP_RESERVE_API_URL: "https://bff.adr.7cav.us/roster/reserves"
REACT_APP_CACHE_TIMESTAMP_URL: "https://bff.adr.7cav.us/cache-timestamp"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout the Repo
uses: actions/checkout@v3
- name: Setup node.js
uses: actions/setup-node@v3
- name: Install Dependancies
run: npm i
working-directory: client
- name: Update Browserlist
run: npx browserslist@latest --update-db
working-directory: client
- name: Build Client to Prod
run: npm run build
working-directory: client
- name: Build client Image
run: docker build --file ./client/Dockerfile --tag registry.digitalocean.com/s6containers/adr_client:$(echo $GITHUB_SHA | head -c7) .
- name: Instal doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Log in to DO Container Registry
run: doctl registry login --expiry-seconds 600
- name: Push image to DO Container Registry
run: docker push registry.digitalocean.com/s6containers/adr_client:$(echo $GITHUB_SHA | head -c7)
- name: Update Deployment File
run: TAG=$(echo $GITHUB_SHA | head -c7) && sed -i 's|<IMAGE>|registry.digitalocean.com/s6containers/adr_client:'${TAG}'|' $GITHUB_WORKSPACE/config/client/deployment.yml
- name: Save DO Kubeconfig with short-lived credentials
run: doctl kubernetes cluster kubeconfig save --expiry-seconds 600 cav-kube
- name: Deploy to DO Cluster
run: kubectl apply -f $GITHUB_WORKSPACE/config/client/deployment.yml
- name: Verify Deployment
run: kubectl rollout status deployment/adr-client -n 7cav