Skip to content

Apply plausible domain on production build #25

Apply plausible domain on production build

Apply plausible domain on production build #25

Workflow file for this run

name: Deploy
on:
push:
branches:
- 'main'
- add/plausible-to-v1
env:
PRODUCTION_STORAGE_ACCOUNT_NAME: lulctfproductionfrontend
PRODUCTION_CDN_PROFILE_NAME: lulctfproduction
PRODUCTION_CDN_ENDPOINT: lulctfproduction
PRODUCTION_RESOURCE_GROUP: lulc-production_rg
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.8.0
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
- name: Cache node modules
id: cache-node-modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install
- name: Post install (make sure local.js exists to avoid breaking config)
run: yarn postinstall
- name: Build Prod
run: yarn build
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS_PRODUCTION }}
- name: Upload to blob storage
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch --account-name $PRODUCTION_STORAGE_ACCOUNT_NAME --overwrite -d '$web' -s ./dist
- name: Purge CDN endpoint
uses: azure/CLI@v1
with:
inlineScript: |
az cdn endpoint purge --content-paths "/*" --profile-name $PRODUCTION_CDN_PROFILE_NAME --name $PRODUCTION_CDN_ENDPOINT --resource-group $PRODUCTION_RESOURCE_GROUP
- name: Azure Logout
run: az logout