Merge branch 'main' of https://github.com/pwa-builder/PWABuilder #158
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 PWABuilder web app to staging | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "apps/pwabuilder/**" | |
| - "Dockerfile.production" | |
| - ".github/workflows/deploy-pwabuilder-to-preview.yml" | |
| workflow_dispatch: | |
| env: | |
| # ACR Configuration | |
| ACR_RESOURCE_GROUP: pwabuilder-registry | |
| ACR_NAME: pwabuilder | |
| # Web App Configuration | |
| WEB_APP_NAME: pwabuilder | |
| WEB_APP_RESOURCE_GROUP: pwabuilder-prod # Replace with your Web App's resource group | |
| WEB_APP_SLOT: preview # Deployment slot name | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Log in to Azure with Managed Identity | |
| uses: azure/login@v2 | |
| with: | |
| client-id: ${{ secrets.AZURE_WESTUS3_APP_ID }} | |
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | |
| - name: Log in to Azure docker registry (ACR) | |
| run: az acr login --name ${{ env.ACR_NAME }} | |
| - name: Docker info | |
| run: docker info | |
| - name: Docker build | |
| run: docker build . --file Dockerfile.production --tag pwabuilder.azurecr.io/pwabuilder:production -m 4GB | |
| - name: Docker push | |
| run: docker push pwabuilder.azurecr.io/pwabuilder:production | |
| - name: Restart Azure Web App Staging Slot | |
| run: | | |
| echo "🔄 Restarting Azure Web App staging slot to pull latest container..." | |
| # Force Web App staging slot to pull latest container image | |
| az webapp config container set \ | |
| --name ${{ env.WEB_APP_NAME }} \ | |
| --resource-group ${{ env.WEB_APP_RESOURCE_GROUP }} \ | |
| --slot ${{ env.WEB_APP_SLOT }} \ | |
| --docker-custom-image-name pwabuilder.azurecr.io/pwabuilder:production | |
| # Restart the Web App staging slot | |
| az webapp restart --name ${{ env.WEB_APP_NAME }} --resource-group ${{ env.WEB_APP_RESOURCE_GROUP }} --slot ${{ env.WEB_APP_SLOT }} | |
| echo "✅ Web App staging slot restart completed" |