Skip to content

Commit

Permalink
seperate manual and autodeploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Vercin-G committed Jan 22, 2024
1 parent 536aa3b commit 00ea75e
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions

name: BETA_CLIENT_ADR_PUSH
name: BETA_CLIENT_AUTO_DEPLOY

# Controls when the workflow will run
on:
Expand All @@ -11,7 +11,6 @@ on:
- ".github/workflows/beta_client_adr_push.yml"
- "src/app/**"
- "config/client/**"
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down
66 changes: 66 additions & 0 deletions .github/workflows/beta_client_manual_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# This is a basic workflow to help you get started with Actions

name: BETA_CLIENT_MANUAL_DEPLOY

# Controls when the workflow will run
on:
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.apps.7cav.us/roster/combat"
REACT_APP_RESERVE_API_URL: "https://bff.apps.7cav.us/roster/reserves"
REACT_APP_CACHE_TIMESTAMP_URL: "https://bff.apps.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: src

- name: Update Browserlist
run: npx browserslist@latest --update-db
working-directory: src

- name: Build Client to Prod
run: npm run build
working-directory: src

- name: Build client Image
run: docker build --file ./src/app/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

0 comments on commit 00ea75e

Please sign in to comment.