When IS_STATIC_EXPORT=true is set, Azure SWA automatically detects Next.js static export output at 'out/' directory. Explicitly setting output_location causes artifact detection to fail. Per Azure official documentation: https://learn.microsoft.com/en-us/azure/static-web-apps/deploy-nextjs-static-export
45 lines
1.2 KiB
YAML
45 lines
1.2 KiB
YAML
name: Azure Static Web Apps CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- gzy
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build_and_deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20.11.1'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build Next.js application
|
|
run: npm run build
|
|
env:
|
|
NEXT_PUBLIC_DATA_INGESTION_URL: ${{ secrets.NEXT_PUBLIC_DATA_INGESTION_URL }}
|
|
NEXT_PUBLIC_MCP_SERVER_URL: ${{ secrets.NEXT_PUBLIC_MCP_SERVER_URL }}
|
|
NEXT_PUBLIC_API_GATEWAY_URL: ${{ secrets.NEXT_PUBLIC_API_GATEWAY_URL }}
|
|
|
|
- name: Deploy to Azure Static Web Apps
|
|
uses: Azure/static-web-apps-deploy@v1
|
|
with:
|
|
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }}
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
action: 'upload'
|
|
app_location: '/'
|
|
api_location: ''
|
|
output_location: ''
|
|
skip_app_build: true
|
|
skip_deploy_on_missing_secrets: true
|
|
env:
|
|
IS_STATIC_EXPORT: true
|