Update README.md #30
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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: CI/CD | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| build-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Lint (ruff) | |
| run: ruff check . --fix | |
| - name: Run tests | |
| env: | |
| PYTHONPATH: ${{ github.workspace }} | |
| run: python -m pytest -q | |
| deploy: | |
| needs: build-test | |
| runs-on: ubuntu-latest | |
| environment: production | |
| env: | |
| AZURE_WEBAPP_NAME: devops-starter-webapp-dev31 # <-- hard-coded to avoid vars.* | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Clear, explicit check so failures are obvious | |
| - name: Check publish profile presence | |
| run: | | |
| if [ -z "${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}" ]; then | |
| echo "Missing secret: AZURE_WEBAPP_PUBLISH_PROFILE"; exit 1 | |
| else | |
| echo "Publish profile secret present" | |
| fi | |
| - name: Azure WebApp Deploy | |
| uses: azure/webapps-deploy@v3 | |
| with: | |
| app-name: ${{ env.AZURE_WEBAPP_NAME }} | |
| publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} | |
| package: . |