Merge pull request #38 from knowall-ai/claude/add-cicd-checks-VgyMl #2
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 to Azure App Service | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| AZURE_WEBAPP_NAME: devdesk-knowall | |
| AZURE_WEBAPP_PACKAGE_PATH: '.' | |
| NODE_VERSION: '20.x' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build application | |
| run: npm run build | |
| env: | |
| # Build-time environment variables (non-sensitive) | |
| NEXT_TELEMETRY_DISABLED: 1 | |
| # Runtime config (public) | |
| NEXTAUTH_URL: https://devdesk.knowall.ai | |
| APP_URL: https://devdesk.knowall.ai | |
| - name: Upload artifact for deployment | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nextjs-app | |
| path: | | |
| .next/ | |
| public/ | |
| package.json | |
| package-lock.json | |
| next.config.ts | |
| retention-days: 1 | |
| deploy: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: production | |
| url: https://devdesk.knowall.ai | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: nextjs-app | |
| - name: Setup Node.js for production | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| - name: Install production dependencies | |
| run: npm ci --production | |
| - name: Deploy to Azure Web App | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} | |
| - name: Configure App Settings | |
| uses: azure/appservice-settings@v1 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| mask-inputs: true | |
| app-settings-json: | | |
| [ | |
| {"name": "NEXTAUTH_URL", "value": "https://devdesk.knowall.ai"}, | |
| {"name": "NEXTAUTH_SECRET", "value": "${{ secrets.NEXTAUTH_SECRET }}"}, | |
| {"name": "AZURE_AD_CLIENT_ID", "value": "${{ secrets.AZURE_AD_CLIENT_ID }}"}, | |
| {"name": "AZURE_AD_CLIENT_SECRET", "value": "${{ secrets.AZURE_AD_CLIENT_SECRET }}"}, | |
| {"name": "AZURE_AD_TENANT_ID", "value": "${{ secrets.AZURE_AD_TENANT_ID }}"}, | |
| {"name": "AZURE_DEVOPS_ORG", "value": "KnowAll"}, | |
| {"name": "AZURE_DEVOPS_PAT", "value": "${{ secrets.AZURE_DEVOPS_PAT }}"}, | |
| {"name": "EMAIL_WEBHOOK_SECRET", "value": "${{ secrets.EMAIL_WEBHOOK_SECRET }}"}, | |
| {"name": "SMTP_HOST", "value": "smtp.office365.com"}, | |
| {"name": "SMTP_PORT", "value": "587"}, | |
| {"name": "SMTP_USER", "value": "devdesk@knowall.ai"}, | |
| {"name": "SMTP_PASSWORD", "value": "${{ secrets.SMTP_PASSWORD }}"}, | |
| {"name": "SMTP_FROM", "value": "devdesk@knowall.ai"}, | |
| {"name": "SMTP_FROM_NAME", "value": "DevDesk Support"} | |
| ] | |
| notify: | |
| runs-on: ubuntu-latest | |
| needs: deploy | |
| if: always() | |
| steps: | |
| - name: Notify on success | |
| if: ${{ needs.deploy.result == 'success' }} | |
| run: echo "Deployment to devdesk.knowall.ai completed successfully!" | |
| - name: Notify on failure | |
| if: ${{ needs.deploy.result == 'failure' }} | |
| run: | | |
| echo "Deployment failed!" | |
| exit 1 |