This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
98 lines (88 loc) · 3.32 KB
/
deploy-notice-management.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Notice Management (Deploy)
on:
workflow_dispatch:
workflow_run:
workflows: ["Notice Management (Package)"]
branches: [main]
types:
- completed
permissions:
id-token: write
contents: read
env:
ARTIFACT_NAME: notice-management
FUNCTION_PACKAGE_PATH: function
jobs:
deploy_to_staging:
name: Deploy to Staging environment
env:
AZURE_RESOURCEGROUP_NAME: "azure-deprecation-notices-staging"
AZURE_FUNCTIONAPP_NAME: azure-deprecation-notices-notice-management-staging
environment:
name: notice-management-staging
runs-on: ubuntu-latest
steps:
# Download artifact
- name: Download Artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: package-notice-management.yml
workflow_conclusion: success
name: ${{ env.ARTIFACT_NAME }}
# Login to Azure
- uses: azure/login@v1
with:
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
client-id: ${{ secrets.AZURE_DEPLOYMENT_STAGING_CLIENT_ID }}
# Deploy ARM template
- uses: azure/arm-deploy@v1
with:
resourceGroupName: ${{ env.AZURE_RESOURCEGROUP_NAME }}
deploymentName: notifice-management-run-${{ github.run_number }}
template: notice-management.bicep
parameters: notice-management.parameters.staging.json githubPersonalAccessToken=${{ secrets.BOT_GITHUB_TOKEN }}
- name: Deploy Azure Function
id: deploy-to-azure
uses: Azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.FUNCTION_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}
deploy_to_production:
name: Deploy to Production environment
needs: [deploy_to_staging]
env:
AZURE_RESOURCEGROUP_NAME: "azure-deprecation-notices"
AZURE_FUNCTIONAPP_NAME: azure-deprecation-notices-notice-management
environment:
name: notice-management-production
runs-on: ubuntu-latest
steps:
# Download artifact
- name: Download Artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: package-notice-management.yml
workflow_conclusion: success
name: ${{ env.ARTIFACT_NAME }}
# Login to Azure
- uses: azure/login@v1
with:
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
client-id: ${{ secrets.AZURE_DEPLOYMENT_PRODUCTION_CLIENT_ID }}
# Deploy ARM template
- uses: azure/arm-deploy@v1
with:
resourceGroupName: ${{ env.AZURE_RESOURCEGROUP_NAME }}
deploymentName: notifice-management-run-${{ github.run_number }}
template: notice-management.bicep
parameters: notice-management.parameters.production.json githubPersonalAccessToken=${{ secrets.BOT_GITHUB_TOKEN }}
- name: Deploy Azure Function
id: deploy-to-azure
uses: Azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: ${{ env.FUNCTION_PACKAGE_PATH }}
publish-profile: ${{ secrets.AZURE_PUBLISH_PROFILE }}