-
Notifications
You must be signed in to change notification settings - Fork 9
45 lines (41 loc) · 1.84 KB
/
build_and_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Build and deploy
on:
push:
branches: [master]
pull_request_target:
paths-ignore: ['.vscode/**']
# trigger after successful scrape, as push from scrape action doesn't trigger a push event
workflow_run:
workflows: [Scrape]
types: [completed]
# Checkout branch and comment on PR
permissions:
contents: read
pull-requests: write
jobs:
swa:
# if not a PR, or an internal PR, or PR has 'safe to test' label
if: github.event_name != 'pull_request_target' || github.event.pull_request.head.repo.full_name == github.repository || contains(github.event.pull_request.labels.*.name, 'safe to test')
runs-on: ubuntu-latest
name: Static Web App
steps:
# NOTE - THIS CHECKOUT MAY CONTAIN UNTRUSTED CODE
# TO AVOID SECRET DISCLOSURE, IT MUST ONLY RUN IN THE SANDBOXED AZURE BUILD ENVIRONMENT
- name: Checkout from PR
uses: actions/[email protected]
with:
persist-credentials: false
# conditional - https://github.community/t/possible-to-use-conditional-in-the-env-section-of-a-job/135170/2
# merge commit ref syntax - https://github.com/actions/checkout/issues/518#issuecomment-890401887
ref: ${{ github.event_name != 'pull_request_target' && github.ref || format('refs/pull/{0}/merge',github.event.number) }}
- name: Build and deploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_SWA_DEPLOY_TOKEN }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # GitHub bot comments only, not available to code
action: upload
app_location: . # Root
app_artifact_location: build # Build artifacts
api_location: api # Functions
env:
REACT_APP_INSIGHTS_STRING: ${{ secrets.REACT_APP_INSIGHTS_STRING }} # this is public, not actually secret