Repository navigation
70 lines (62 loc) · 2.29 KB
/
Copy pathdeploy.yaml
File metadata and controls
70 lines (62 loc) · 2.29 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Deploy Infra and App
on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main
env:
RESOURCE_GROUP: 'rg-swa-sso'
RESOURCE_TAGS: '{"owner":"rick.roche", "app":"azure-swa-sso", "repo":"https://github.com/rick-roche/azure-static-web-apps-sso" }'
APP_NAME: 'swa-sso'
LOCATION: 'westeurope'
jobs:
deploy-infra:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16'
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Deploy Infra
id: deploy_infra
if: github.event_name != 'pull_request'
uses: azure/CLI@v1
with:
inlineScript: |
az deployment group create \
--resource-group ${{ env.RESOURCE_GROUP }} \
--template-file ./infra/main.bicep \
--parameters \
appName='${{ env.APP_NAME }}' \
location='${{ env.LOCATION }}' \
repositoryUrl='https://github.com/rick-roche/azure-static-web-apps-sso' \
repositoryToken='${{ secrets.WORKFLOW_TOKEN }}' \
tags='${{ env.RESOURCE_TAGS }}'
- name: Get Static Web App API Key
id: static_web_app_apikey
if: github.event_name != 'pull_request'
uses: azure/CLI@v1
with:
inlineScript: |
APIKEY=$(az staticwebapp secrets list --name 'stapp-${{ env.APP_NAME }}' | jq -r '.properties.apiKey')
echo "::set-output name=APIKEY::$APIKEY"
- name: Deploy WebApp to Static Web App
id: static_web_app_deploy
if: github.event_name != 'pull_request'
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ steps.static_web_app_apikey.outputs.APIKEY }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for GitHub integrations (i.e. PR comments)
action: 'upload'
# Build configuration for Azure Static Web Apps: https://aka.ms/swaworkflowconfig
app_location: 'webapp'
api_location: ''
output_location: 'build' # relative to app_location