Add Claude Code sub-agents #28
Workflow file for this run
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 SWA to Staging Environment | |
| # Deploys the React frontend to the "staging" environment within the | |
| # production SWA (swa-sudoku-xenobiasoft-prod). This gives a live preview | |
| # at the SWA-assigned staging URL and at sudoku-beta.xenobiasoft.com once | |
| # the custom domain is wired up in the portal / Bicep. | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: [main] | |
| push: | |
| branches: [staging] | |
| workflow_dispatch: | |
| env: | |
| # Targets the same SWA resource as production — just a different environment slot. | |
| AZURE_SWA_NAME: swa-sudoku-xenobiasoft-prod | |
| SWA_DEPLOYMENT_ENV: staging | |
| permissions: | |
| contents: read | |
| id-token: write | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| build-and-test-frontend: | |
| if: github.event.action != 'closed' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: src/frontend/Sudoku.React/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: src/frontend/Sudoku.React | |
| - name: Run frontend tests | |
| run: npm run test | |
| working-directory: src/frontend/Sudoku.React | |
| - name: Build frontend (staging) | |
| run: npm run build | |
| working-directory: src/frontend/Sudoku.React | |
| env: | |
| VITE_API_BASE_URL: ${{ vars.VITE_API_BASE_URL_STAGING }} | |
| - name: Upload frontend artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: src/frontend/Sudoku.React/dist | |
| deploy-swa-staging: | |
| needs: build-and-test-frontend | |
| if: github.event.action != 'closed' | |
| runs-on: ubuntu-latest | |
| environment: staging | |
| steps: | |
| - name: Azure Login | |
| uses: azure/login@v2 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - name: Get SWA deployment token | |
| id: swa-token | |
| run: | | |
| TOKEN=$(az staticwebapp secrets list \ | |
| --name ${{ env.AZURE_SWA_NAME }} \ | |
| --query "properties.apiKey" \ | |
| --output tsv) | |
| if [ -z "$TOKEN" ]; then | |
| echo "ERROR: Failed to retrieve SWA deployment token for ${{ env.AZURE_SWA_NAME }}" >&2 | |
| exit 1 | |
| fi | |
| echo "::add-mask::$TOKEN" | |
| echo "token=$TOKEN" >> $GITHUB_OUTPUT | |
| - name: Download frontend artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: frontend-dist | |
| path: frontend-dist | |
| - name: Deploy to SWA staging environment | |
| uses: Azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ steps.swa-token.outputs.token }} | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| action: "upload" | |
| app_location: "frontend-dist" | |
| output_location: "" | |
| skip_app_build: true | |
| deployment_environment: ${{ env.SWA_DEPLOYMENT_ENV }} | |
| - name: Print staging URL | |
| run: | | |
| HOSTNAME=$(az staticwebapp environment show \ | |
| --name ${{ env.AZURE_SWA_NAME }} \ | |
| --environment-name ${{ env.SWA_DEPLOYMENT_ENV }} \ | |
| --query "hostname" \ | |
| --output tsv 2>/dev/null || echo "unavailable") | |
| echo "### SWA Staging Environment" >> $GITHUB_STEP_SUMMARY | |
| echo "Staging URL: https://${HOSTNAME}" >> $GITHUB_STEP_SUMMARY | |
| echo "Custom domain: https://sudoku-beta.xenobiasoft.com" >> $GITHUB_STEP_SUMMARY | |
| delete-staging-environment: | |
| if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
| runs-on: ubuntu-latest | |
| environment: staging | |
| steps: | |
| - name: Azure Login | |
| uses: azure/login@v2 | |
| with: | |
| creds: ${{ secrets.AZURE_CREDENTIALS }} | |
| - name: Get SWA deployment token | |
| id: swa-token | |
| run: | | |
| TOKEN=$(az staticwebapp secrets list \ | |
| --name ${{ env.AZURE_SWA_NAME }} \ | |
| --query "properties.apiKey" \ | |
| --output tsv) | |
| if [ -z "$TOKEN" ]; then | |
| echo "ERROR: Failed to retrieve SWA deployment token for ${{ env.AZURE_SWA_NAME }}" >&2 | |
| exit 1 | |
| fi | |
| echo "::add-mask::$TOKEN" | |
| echo "token=$TOKEN" >> $GITHUB_OUTPUT | |
| - name: Delete SWA staging environment | |
| uses: Azure/static-web-apps-deploy@v1 | |
| with: | |
| azure_static_web_apps_api_token: ${{ steps.swa-token.outputs.token }} | |
| action: "close" | |
| deployment_environment: ${{ env.SWA_DEPLOYMENT_ENV }} |