generated from SSWConsulting/SSW.GitHub.Template
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (73 loc) · 2.42 KB
/
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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
name: deploy
on:
workflow_call:
inputs:
environment:
description: "Name of the environment to deploy to"
required: true
type: string
url:
description: "URL of the site"
required: false
type: string
permissions:
id-token: write
contents: read
checks: write
defaults:
run:
shell: pwsh
jobs:
deploy-bicep:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
url: ${{ inputs.url }}
outputs:
storageName: ${{steps.deploy-bicep.outputs.websiteStorageAccountName}}
env:
AZURE_RESOURCE_GROUP: ${{ secrets.AZURE_RESOURCE_GROUP}}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
TENANT_ID: ${{ secrets.TENANT_ID }}
SUBSCRIPTION_ID: ${{ secrets.SUBSCRIPTION_ID }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Login to Azure
uses: azure/login@v1
with:
client-id: ${{ env.CLIENT_ID }}
tenant-id: ${{ env.TENANT_ID }}
subscription-id: ${{ env.SUBSCRIPTION_ID }}
- name: Validate Bicep
uses: azure/arm-deploy@v1
with:
failOnStdErr: false
template: infra/deploy.bicep
resourceGroupName: ${{env.AZURE_RESOURCE_GROUP}}
subscriptionId: ${{secrets.SUBSCRIPTION_ID}}
scope: resourcegroup
additionalArguments: "--what-if"
parameters: projectName=SSW.Dory environment=${{inputs.environment}} tags="{\"Deployed\":\"yes\", \"cost-category\":\"value\"}"
- name: Deploy Bicep
id: deploy-bicep
uses: azure/arm-deploy@v1
with:
failOnStdErr: false
template: infra/deploy.bicep
resourceGroupName: ${{env.AZURE_RESOURCE_GROUP}}
subscriptionId: ${{secrets.SUBSCRIPTION_ID}}
scope: resourcegroup
parameters: projectName=SSW.Dory environment=${{inputs.environment}} tags="{\"Deployed\":\"yes\", \"cost-category\":\"value\"}"
- name: Staging Preview Url
if: ${{ inputs.environment == 'staging' }}
run: |
echo "## Staging Preview Url" >> $GITHUB_STEP_SUMMARY
echo "https://staging.sswdory.com" >> $GITHUB_STEP_SUMMARY
deploy-site-prod:
uses: ./.github/workflows/deploy-static-site.yml
with:
environment: ${{inputs.environment}}
storageName: ${{needs.deploy-bicep.outputs.storageName}}
secrets: inherit
needs: deploy-bicep