-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (87 loc) · 2.67 KB
/
errors-to-slack.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
99
100
101
102
103
name: 'SendErrorsToSlack'
on:
workflow_dispatch:
push:
branches:
- 'main'
paths:
- '2023-02_Errors_to_Slack/**'
env:
alertOriginName: app-alertorigin
alertHandlerName: func-alerthandler
location: norwayeast
resourceGroupName: novanet-rg-alerts
workingDirectory: './2023-02_Errors_to_Slack'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '7.0.x'
- name: Restore
run: dotnet restore
working-directory: ${{ env.workingDirectory }}
- name: Build
run: dotnet build -c Release --nologo --no-restore
working-directory: ${{ env.workingDirectory }}
- name: Publish
run: dotnet publish -c Release -o ./artifacts --self-contained false --nologo --no-restore --no-build
working-directory: ${{ env.workingDirectory }}
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: Artifacts
path: ${{ env.workingDirectory }}/artifacts
if-no-files-found: error
retention-days: 1
provisioning:
name: Create Azure resources
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@main
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Create resource group
uses: azure/[email protected]
with:
inlineScript: az group create -n ${{ env.resourceGroupName }} -l ${{ env.location }}
- name: Deploy Bicep file
uses: azure/arm-deploy@v1
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
resourceGroupName: ${{ env.resourceGroupName }}
template: ${{ env.workingDirectory }}/scripts/main.bicep
parameters: alertOriginName=${{ env.alertOriginName }} alertHandlerName=${{ env.alertHandlerName }}
deploy:
name: Deploy
needs: provisioning
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: Artifacts
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Deploy app AlertOrigin'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.alertOriginName }}
package: '.'
startup-command: 'dotnet AlertOrigin.dll'
- name: Deploy func AlertHandler
uses: azure/functions-action@v1
with:
app-name: ${{ env.alertHandlerName }}
package: '.'