Skip to content

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows … #157

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows …

Bump actions/download-artifact from 3 to 4.1.7 in /.github/workflows … #157

Workflow file for this run

# Front Build and Deploy (Release to blob)
name: front-end-build-deploy
on:
push:
branches: ["v2", "main"]
paths:
- ".github/workflows/fe-cd.yml"
- "client-config-app/**"
- "manifest/**"
- "official-stickers/**"
- "website/**"
permissions:
contents: read
env:
# [INT_CONFIG, PROD_CONFIG]
WEBSITE: ${{ fromJSON('["stickers-test.azureedge.net","sticker.newfuture.cc"]')[ github.ref_name == 'v2'] }}
REACT_APP_API_ROOT: ${{ fromJSON('["https://stickers-test.azurewebsites.net","https://stickers-api.newfuture.cc"]')[ github.ref_name == 'v2'] }}
REACT_APP_AAD_ID: ${{ fromJSON('["eae0aa56-582c-40f7-8daa-b3eb8d1f0732","695d3f13-6131-4224-aacd-26c8aff039d2"]')[ github.ref_name == 'v2'] }}
APP_PRE_FIX: ${{ fromJSON('["[I]",""]')[ github.ref_name == 'v2'] }}
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }}-${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
front-end-build:
runs-on: ubuntu-latest
timeout-minutes: 8
env:
NODE_ENV: production
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 18
- run: yarn
- run: yarn manifest
- run: yarn stickers
- run: yarn client:build
- run: yarn website:build
# Upload build result
- uses: actions/upload-artifact@v3
with:
name: front-end
path: |
website/build/
client-config-app/build/
manifest/build/
official-stickers/build/
retention-days: 10
front-end-deploy:
needs: [front-end-build]
environment:
name: ${{ fromJSON('["Integration","Production"]')[ github.ref_name == 'v2'] }}
url: https://${{env.WEBSITE}}/
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/[email protected]
with:
name: front-end
path: ./
- run: |
mv website/build ./www \
&& mv manifest/build/* ./www/ \
&& mv client-config-app/build ./www/config \
&& mv official-stickers/build ./www/official-stickers \
- name: "Upload to blob storage"
uses: azure/CLI@v1
with:
inlineScript: |
az storage blob upload-batch \
--source ./www/ \
--destination '$web' \
--connection-string "${{secrets.BLOB_CONNECTION_STRING}}" \
--overwrite
# https://learn.microsoft.com/en-us/azure/storage/blobs/storage-blobs-static-site-github-actions?tabs=userlevel
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: "Purge CDN endpoint"
uses: azure/CLI@v1
with:
inlineScript: |
az cdn endpoint purge --content-paths "/" "/config/" --ids "${{secrets.CDN_RESOURCE_ID}}"
# - name: "Preload CDN"
# run: az cdn endpoint load --ids "${{secrets.CDN_RESOURCE_ID}}" --content-paths "/index.html" "/config/index.html" $(find www/ -name "*.js" -type f -printf "/%P")
- name: logout
run: az logout
if: always()