Fix CI smoke tests: create local.settings.json from template #38
This file contains hidden or 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 | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| name: Build & Deploy to Azure | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # --- Functions --- | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: functions/package-lock.json | |
| - name: Install & build Functions | |
| working-directory: functions | |
| run: | | |
| npm ci | |
| npm run build | |
| - name: Run Functions tests | |
| working-directory: functions | |
| run: npm run test:run | |
| - name: Prepare Functions deploy | |
| working-directory: functions | |
| run: | | |
| mkdir -p deploy | |
| cp -r dist deploy/ | |
| cp host.json deploy/ | |
| cp package.json deploy/ | |
| cp package-lock.json deploy/ | |
| echo '{"IsEncrypted":false,"Values":{"FUNCTIONS_WORKER_RUNTIME":"node"}}' > deploy/local.settings.json | |
| cd deploy && npm ci --omit=dev | |
| # --- Web --- | |
| - name: Install & build Web | |
| working-directory: web | |
| run: | | |
| npm ci | |
| npx vite build | |
| cp ../staticwebapp.config.json dist/staticwebapp.config.json | |
| # --- Deploy SWA (frontend + managed API) --- | |
| - name: Deploy to Azure Static Web Apps | |
| uses: Azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ secrets.SWA_DEPLOYMENT_TOKEN }} | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| action: upload | |
| app_location: web/dist | |
| api_location: functions/deploy | |
| skip_app_build: true | |
| skip_api_build: true |