Skip to content

Merge pull request #1110 from AI4Bharat/ana-mas #241

Merge pull request #1110 from AI4Bharat/ana-mas

Merge pull request #1110 from AI4Bharat/ana-mas #241

name: Build and Release React App for Prod
on:
push:
branches: [master]
workflow_dispatch:
workflow_call:
env:
CI: false
NODE_OPTIONS: "--max_old_space_size=4096"
REACT_APP_APIGW_BASE_URL: ${{ secrets.REACT_APP_APIGW_BASE_URL_PROD }}
AZURE_CREDS: ${{ secrets.SHOONYA_AZURE_CREDS_PROD_E2E }}
AZURE_STORAGEKEY: ${{ secrets.SHOONYA_AZURE_STORAGEKEY_PROD_E2E }}
AZURE_STORAGE_CONNECTION_STRING: ${{ secrets.SHOONYA_AZURE_CONNECTION_STRING_PROD_E2E }}
jobs:
cicd:
name: CICD_PROD
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Node.js
uses: actions/setup-node@v2
- name: Install NPM packages
run: npm install --legacy-peer-deps
- name: Build project
run: npm run build
- name: Azure login
uses: azure/login@v1
with:
creds: ${{ env.AZURE_CREDS }}
- name: Upload to blob storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch --connection-string ${{ env.AZURE_STORAGE_CONNECTION_STRING }} --destination '$web' --source ./build --overwrite
- name: Purge CDN endpoint
uses: azure/CLI@v1
with:
inlineScript: |
az cdn endpoint purge --no-wait --content-paths "/*" --profile-name shoonya-prod-cdn --name shoonya-prod-cdn-endpoint --resource-group shoonya-dev
- name: Azure logout
run: |
az logout
if: always()