Deploy magazine to PRE and PRO #36
Workflow file for this run
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: Deploy magazine to PRE and PRO | |
on: | |
workflow_dispatch: | |
env: | |
SITE_PUBLIC_PATH: ./public | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3.8.1 | |
- uses: actions/checkout@v2 | |
- name: Run NPM INSTALL | |
run: npm install --force | |
- name: Node memory | |
run: export NODE_OPTIONS=--max_old_space_size=4096 | |
- name: Run Gatsby | |
run: export NODE_OPTIONS='--max-old-space-size=8192' && npm run build | |
- name: Publish artifacts | |
uses: actions/upload-artifact@v2.2.2 | |
with: | |
name: site | |
path: ${{ env.SITE_PUBLIC_PATH }} | |
deploypre: | |
runs-on: ubuntu-latest | |
needs: build | |
environment: | |
name: pre | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v2.0.8 | |
with: | |
name: site | |
path: ${{ env.SITE_PUBLIC_PATH }} | |
- name: Delete dev site | |
uses: Azure/cli@1.0.4 | |
with: | |
inlineScript: az storage blob delete-batch -s '$web' --account-name ${{ secrets.ACCOUNT_NAME }} --account-key ${{ secrets.ACCOUNT_KEY }} | |
- name: Publish new version at dev | |
uses: Azure/cli@1.0.4 | |
with: | |
inlineScript: az storage blob upload-batch -d '$web' -s ${{ env.SITE_PUBLIC_PATH }} --account-name ${{ secrets.ACCOUNT_NAME }} --account-key ${{ secrets.ACCOUNT_KEY }} | |
deploypro: | |
runs-on: ubuntu-latest | |
needs: deploypre | |
environment: | |
name: pro | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v2.0.8 | |
with: | |
name: site | |
path: ${{ env.SITE_PUBLIC_PATH }} | |
- name: Delete pro site | |
uses: Azure/cli@1.0.4 | |
with: | |
inlineScript: az storage blob delete-batch -s '$web' --account-name ${{ secrets.ACCOUNT_NAME }} --account-key ${{ secrets.ACCOUNT_KEY }} | |
- name: Publish new version at pro | |
uses: Azure/cli@1.0.4 | |
with: | |
inlineScript: az storage blob upload-batch -d '$web' -s ${{ env.SITE_PUBLIC_PATH }} --account-name ${{ secrets.ACCOUNT_NAME }} --account-key ${{ secrets.ACCOUNT_KEY }} |