Repository navigation
Fix Azure App Service startup detection #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: Build and Deploy GoSignal to Azure App Service | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: gosignal-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| AZURE_WEBAPP_NAME: gosignal | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| cache: npm | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Type-check | |
| run: npm run check | |
| - name: Run tests | |
| run: npm test | |
| - name: Build production bundle | |
| run: npm run build | |
| - name: Prune dev dependencies | |
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| run: npm prune --omit=dev | |
| - name: Assemble deployment package | |
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| run: | | |
| mkdir -p release | |
| cp -R dist node_modules package.json package-lock.json README.md server.js release/ | |
| - name: Upload deployment artifact | |
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gosignal-release | |
| path: release | |
| if-no-files-found: error | |
| deploy: | |
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main') | |
| needs: build-test | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Validate Azure deployment settings | |
| env: | |
| AZURE_WEBAPP_PUBLISH_PROFILE: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_9492FD61CE93436AAFF591EA984DB633 }} | |
| run: | | |
| test -n "$AZURE_WEBAPP_NAME" || (echo "Missing AZURE_WEBAPP_NAME in workflow env" && exit 1) | |
| test -n "$AZURE_WEBAPP_PUBLISH_PROFILE" || (echo "Missing GitHub repository secret AZUREAPPSERVICE_PUBLISHPROFILE_9492FD61CE93436AAFF591EA984DB633" && exit 1) | |
| - name: Download deployment artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: gosignal-release | |
| path: release | |
| - name: Deploy to Azure App Service | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| slot-name: Production | |
| publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_9492FD61CE93436AAFF591EA984DB633 }} | |
| package: release |