-
Notifications
You must be signed in to change notification settings - Fork 3
76 lines (64 loc) · 2.09 KB
/
02-Deployment-API.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
name: 02-Deployment-API
on:
push:
paths:
- 'src/github-app/**'
workflow_dispatch:
env:
CONFIGURATION: 'release'
AZ_RG_NAME: 'rg-ghdashboard'
AZ_APP_NAME: 'app-ghdashboard'
AZ_BLOB_NAME: 'stvmghdashboard'
CSPROJ: 'src/github-dashboard.api/github-dashboard.api.csproj'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore ${{ env.CSPROJ }}
- name: Build
run: dotnet build ${{ env.CSPROJ }} --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Publish
run: dotnet publish --configuration ${{ env.CONFIGURATION }} --output MyPublishApp ${{ env.CSPROJ }}
- name: Upload dotnet publish results
uses: actions/upload-artifact@v4
with:
name: dotnet-publish
path: MyPublishApp
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: dotnet-publish
path: my-app-artifact
- name: Login
uses: azure/login@v2
with:
creds: ${{ secrets.AZ_CREDENTIALS }}
- uses: azure/webapps-deploy@v3
name: Deploy to Azure
with:
app-name: ${{ env.AZ_APP_NAME }}
package: my-app-artifact
- name: Get Blob storage connection string
run: |
echo "BLOB_CONNECTION_STRING=$(az storage account show-connection-string --name ${{ env.AZ_BLOB_NAME }} --resource-group ${{ env.AZ_RG_NAME }} --query connectionString -o tsv)" >> $GITHUB_ENV
- name: Set APP Settings
uses: Azure/appservice-settings@v1
with:
app-name: ${{ env.AZ_APP_NAME }}
app-settings-json: |
[
{
"name": "ConnectionStrings__BlobStorage",
"value": "${{ env.BLOB_CONNECTION_STRING }}",
"slotSetting": false
}
]