Skip to content

Added CI

Added CI #3

#
name: Deploy UI to Azure AKS
on:
push:
branches: ["release", "main", "add-correct-cicd-wf"]
workflow_dispatch:
inputs:
environment:
description: 'Select the env'
type: environment
required: true
jobs:
run:
runs-on: ubuntu-latest
environment: ${{ github.ref == 'main' && inputs.environment == '' && 'production' || 'production' }} # TODO: change last production to staging
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Set up AKS context
uses: azure/aks-set-context@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
cluster-name: ${{vars.CLUSTER_NAME}}
resource-group: ${{vars.AZURE_RESOURCE_GROUP}}
- name: Remove package-lock.json
run: rm -rf package-lock.json
- name: Install dependencies
run: npm install
- name: Make envfile
uses: SpicyPizza/[email protected]
with:
envkey_VITE_API_URL: ${{ vars.VITE_API_URL }}
envkey_VITE_AUTH0_STATUS: ${{ vars.VITE_AUTH0_STATUS }}
envkey_VITE_AUTH0_DOMAIN: ${{ secrets.VITE_AUTH0_DOMAIN }}
envkey_VITE_AUTH0_CLIENT_ID: ${{ secrets.VITE_AUTH0_CLIENT_ID }}
envkey_VITE_AUTH0_AUDIENCE: ${{ secrets.VITE_AUTH0_AUDIENCE }}
file_name: .env.${{ inputs.environment }}
- name: Build
run: npm run build:${{ inputs.environment }}
- name: Upload to blob storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch \
--destination ${{vars.AZURE_CONTAINER_BLOB}} \
--account-name ${{vars.AZURE_CONTAINER_ACCOUNT}} \
--source ./dist \
--destination-path ${{vars.APPLICATION_NAME}} \
--overwrite
- name: Kubernetes Deployment
run: |
kubectl -n ${{vars.KUBERNETES_NAMESPACE}} rollout restart deployment/${{vars.APPLICATION_NAME}}
#