|
| 1 | +# This workflow will build and push a web application to an Azure Static Web App when you change your code. |
| 2 | +# |
| 3 | +# This workflow assumes you have already created the target Azure Static Web App. |
| 4 | +# For instructions see https://docs.microsoft.com/azure/static-web-apps/get-started-portal?tabs=vanilla-javascript |
| 5 | +# |
| 6 | +# To configure this workflow: |
| 7 | +# |
| 8 | +# 1. Set up a secret in your repository named AZURE_STATIC_WEB_APPS_API_TOKEN with the value of your Static Web Apps deployment token. |
| 9 | +# For instructions on obtaining the deployment token see: https://docs.microsoft.com/azure/static-web-apps/deployment-token-management |
| 10 | +# |
| 11 | +# 3. Change the values for the APP_LOCATION, API_LOCATION and APP_ARTIFACT_LOCATION, AZURE_STATIC_WEB_APPS_API_TOKEN environment variables (below). |
| 12 | +# For instructions on setting up the appropriate configuration values go to https://docs.microsoft.com/azure/static-web-apps/front-end-frameworks |
| 13 | +name: Deploy web app to Azure Static Web Apps |
| 14 | + |
| 15 | +on: |
| 16 | + push: |
| 17 | + branches: [ "cleanTest" ] |
| 18 | + |
| 19 | +# Environment variables available to all jobs and steps in this workflow |
| 20 | +env: |
| 21 | + APP_LOCATION: "src/conference-ia" # location of your client code |
| 22 | + API_LOCATION: "api" # location of your api source code - optional |
| 23 | + APP_ARTIFACT_LOCATION: "src/conference-ia/dist" # location of client code build output |
| 24 | + AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing deployment token for your static web app |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + |
| 29 | +jobs: |
| 30 | + build_and_deploy_job: |
| 31 | + permissions: |
| 32 | + contents: read # for actions/checkout to fetch code |
| 33 | + pull-requests: write # for Azure/static-web-apps-deploy to comment on PRs |
| 34 | + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed') |
| 35 | + runs-on: ubuntu-latest |
| 36 | + name: Build and Deploy Job |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v4 |
| 39 | + with: |
| 40 | + submodules: true |
| 41 | + - name: Build And Deploy |
| 42 | + id: builddeploy |
| 43 | + uses: Azure/static-web-apps-deploy@v1 |
| 44 | + with: |
| 45 | + azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing api token for app |
| 46 | + repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments) |
| 47 | + action: "upload" |
| 48 | + ###### Repository/Build Configurations - These values can be configured to match you app requirements. ###### |
| 49 | + # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig |
| 50 | + app_location: ${{ env.APP_LOCATION }} |
| 51 | + api_location: ${{ env.API_LOCATION }} |
| 52 | + app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }} |
| 53 | + ###### End of Repository/Build Configurations ###### |
| 54 | + |
| 55 | + close_pull_request_job: |
| 56 | + permissions: |
| 57 | + contents: none |
| 58 | + if: github.event_name == 'pull_request' && github.event.action == 'closed' |
| 59 | + runs-on: ubuntu-latest |
| 60 | + name: Close Pull Request Job |
| 61 | + steps: |
| 62 | + - name: Close Pull Request |
| 63 | + id: closepullrequest |
| 64 | + uses: Azure/static-web-apps-deploy@v1 |
| 65 | + with: |
| 66 | + azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing api token for app |
| 67 | + action: "close" |
0 commit comments