microsoft/AI-For-Beginners

Public

mirrored fromhttps://github.com/microsoft/AI-For-BeginnersAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
d37482b946afa5f8055f9ecec8af798391549e78

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

.github/workflows/azure-staticwebapp.yml

72lines · modecode

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
13name: Deploy web app to Azure Static Web Apps
14
15on:
16 push:
17 branches:
18 - "main"
19 pull_request:
20 types: [opened, synchronize, reopened, closed]
21 branches:
22 - "main"
23
24# Environment variables available to all jobs and steps in this workflow
25env:
26 APP_LOCATION: "/" # location of your client code
27 API_LOCATION: "api" # location of your api source code - optional
28 APP_ARTIFACT_LOCATION: "build" # location of client code build output
29 AZURE_STATIC_WEB_APPS_API_TOKEN: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN }} # secret containing deployment token for your static web app
30
31permissions:
32 contents: read
33
34jobs:
35 build_and_deploy_job:
36 permissions:
37 contents: read # for actions/checkout to fetch code
38 pull-requests: write # for Azure/static-web-apps-deploy to comment on PRs
39 if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')
40 runs-on: ubuntu-latest
41 name: Build and Deploy Job
42 steps:
43 - uses: actions/checkout@v3
44 with:
45 submodules: true
46 - name: Build And Deploy
47 id: builddeploy
48 uses: Azure/static-web-apps-deploy@v1
49 with:
50 azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_SAND_043CA7603 }} # secret containing api token for app
51 repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
52 action: "upload"
53 ###### Repository/Build Configurations - These values can be configured to match you app requirements. ######
54 # For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
55 app_location: ${{ env.APP_LOCATION }}
56 api_location: ${{ env.API_LOCATION }}
57 app_artifact_location: ${{ env.APP_ARTIFACT_LOCATION }}
58 ###### End of Repository/Build Configurations ######
59
60 close_pull_request_job:
61 permissions:
62 contents: none
63 if: github.event_name == 'pull_request' && github.event.action == 'closed'
64 runs-on: ubuntu-latest
65 name: Close Pull Request Job
66 steps:
67 - name: Close Pull Request
68 id: closepullrequest
69 uses: Azure/static-web-apps-deploy@v1
70 with:
71 azure_static_web_apps_api_token: ${{ env.AZURE_STATIC_WEB_APPS_API_TOKEN_VICTORIOUS_SAND_043CA7603 }} # secret containing api token for app
72 action: "close"
73