Skip to content

Deploy Demo App To Staging After Merge #163

Deploy Demo App To Staging After Merge

Deploy Demo App To Staging After Merge #163

name: Deploy Demo App
run-name: Deploy Demo App To Staging After Merge
on:
push:
branches: [ main ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: 💾 Checking out the repository
uses: actions/checkout@v4
- name: ⚙️ Setting up the MonkJs project
uses: ./.github/actions/monkjs-set-up
with:
build-env: production
- name: 📱 Building the demo app
run: cd apps/demo-app && yarn build:staging
- name: 📦 Uploading the artifact
uses: actions/[email protected]
with:
name: build-demo-app-staging
path: apps/demo-app/build
if-no-files-found: error
deploy:
name: Deploy
environment: staging
needs:
- build
container:
image: dtzar/helm-kubectl:3.14.2
runs-on: ubuntu-latest
steps:
- name: 🔐 Authenticating to Google Cloud
uses: google-github-actions/[email protected]
with:
credentials_json: "${{ secrets.GKE_SA_KEY }}"
- name: 🔐 Obtaining GKE credentials
uses: google-github-actions/[email protected]
with:
cluster_name: ${{ secrets.GKE_CLUSTER }}
location: ${{ secrets.GKE_ZONE }}
project_id: ${{ secrets.GKE_PROJECT }}
- name: 📦 Downloading the artifact
uses: actions/[email protected]
with:
name: build-demo-app-staging
path: demo
- name: 🧹 Cleaning up previous build
run: |-
kubectl -n poc exec -it $(kubectl get pods -n poc -l app.kubernetes.io/instance=poc-spa --no-headers | awk '{print $1}') -- rm -rf demo
- name: 🌐 Deploying app
run: |-
kubectl -n poc cp demo poc/$(kubectl get pods -n poc -l app.kubernetes.io/instance=poc-spa --no-headers | awk '{print $1}'):/app/