Merge pull request #849 from AI4Bharat/compare-edits #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Prod Environment - Build and Release React App | |
on: | |
push: | |
branches: [master] | |
env: | |
CI: false | |
NODE_OPTIONS: "--max_old_space_size=4096" | |
REACT_APP_APIGW_BASE_URL: ${{ vars.PROD__REACT_APP_APIGW_BASE_URL }} | |
AZURE_STORAGE_ACCOUNT_NAME: ${{ vars.PROD__AZURE_STORAGE_ACCOUNT_NAME }} | |
AZURE_STORAGEKEY: ${{ secrets.PROD__AZURE_STORAGEKEY }} | |
AZURE_CDN_PROFILE: ${{ vars.PROD__AZURE_CDN_PROFILE }} | |
AZURE_ENDPOINT_NAME: ${{ vars.PROD__AZURE_ENDPOINT_NAME }} | |
AZURE_RESOURCE_GROUP: ${{ vars.PROD__AZURE_RESOURCE_GROUP }} | |
REACT_APP_CLIENT_ID: ${{ vars.REACT_APP_CLIENT_ID }} | |
REACT_APP_CLIENT_SECRET: ${{ vars.REACT_APP_CLIENT_SECRET }} | |
REACT_APP_SCOPE: ${{ vars.REACT_APP_SCOPE }} | |
jobs: | |
cicd: | |
name: DEV__CICD | |
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: ${{ secrets.PROD_AZURE_CREDS }} | |
- name: Upload to blob storage | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az storage blob upload-batch --account-name ${{ env.AZURE_STORAGE_ACCOUNT_NAME }} --account-key ${{ env.AZURE_STORAGEKEY }} -d '$web' -s ./build --overwrite | |
- name: Purge CDN endpoint | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az cdn endpoint purge --no-wait --content-paths "/*" --profile-name ${{ env.AZURE_CDN_PROFILE }} --name ${{ env.AZURE_ENDPOINT_NAME }} --resource-group ${{ env.AZURE_RESOURCE_GROUP }} | |
- name: Azure logout | |
run: | | |
az logout | |
if: always() |