Publish nightly build #145
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: "Publish nightly build" | |
on: | |
pull_request: | |
branches: [production] | |
schedule: | |
- cron: '0 0 * * *' | |
env: | |
NODE_ENV: production | |
API_URL: ${{ secrets.API_URL }} | |
jobs: | |
build: | |
name: Setup build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- name: Checkout code on prod branch | |
uses: actions/checkout@v4 | |
with: | |
ref: production | |
- name: Setup node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install | |
run: | | |
npm i -g yarn dotenv | |
yarn install --production=false | |
- name: Get responses from Google Sheet | |
run: node tasks/google-forms.js | |
- name: Make production build | |
run: yarn build | |
- name: Login to Azure | |
uses: azure/[email protected] | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
# Deploy static build to Azure storage if succeeded | |
- name: Deploy static build | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az storage blob upload-batch --overwrite true --account-name fairmountstories --auth-mode key -d '$web' -s ./build | |
- name: Purge CDN endpoint | |
uses: azure/CLI@v1 | |
with: | |
inlineScript: | | |
az cdn endpoint purge --content-paths "/*" --profile-name web-apps -n fairmountstories -g web | |
# Azure logout | |
- name: logout | |
run: | | |
az logout | |
if: always() |