Merge pull request #131 from BlazeFace/dependabot/npm_and_yarn/svelte… #187
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: NodeJS Build | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
strategy: | |
matrix: | |
node-version: [20.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: azure/login@v2 | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
cache: 'npm' | |
- name: Copy to .env | |
run: | | |
state=$(cat state.yaml) | |
printf "PUBLIC_STATE=\"\n$state\"" > .env | |
- run: npm ci | |
- run: npx playwright install | |
- run: npm run build --if-present | |
- run: npm test | |
- name: Upload to blob storage | |
uses: azure/CLI@v2 | |
with: | |
inlineScript: | | |
az storage blob upload-batch --account-name blzai --auth-mode login -d '$web' -s ./build --overwrite --output none | |
- name: Purge CDN endpoint | |
uses: azure/CLI@v2 | |
with: | |
inlineScript: | | |
az cdn endpoint purge --content-paths "/*" --profile-name blzai-static --name blzai --resource-group blz.ai --output none | |
# Azure logout | |
- name: logout | |
run: | | |
az logout | |
if: always() | |