-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (90 loc) · 3.15 KB
/
Copy pathazure-functions-app-dotnet.yml
File metadata and controls
105 lines (90 loc) · 3.15 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
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
104
105
name: Build Azure Function App .NET
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
workflow_dispatch:
concurrency:
# Ensure only one run of this workflow executes at a time across the repo.
# New runs will be queued until the current run completes.
group: ${{ github.workflow }}
cancel-in-progress: false
env:
AZURE_FUNCTIONAPP_NAME: "your-app-name" # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: "DemoFunctionNet6" # set this to the path to your function app project, defaults to the repository root
CONFIGURATION: "Release"
jobs:
infrastructure:
runs-on: ubuntu-latest
environment: dev
permissions:
contents: read
id-token: write
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@v6
- name: "Login via Azure CLI"
uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Deploy Bicep
uses: azure/bicep-deploy@v2
with:
type: deploymentStack
operation: create
name: Development
location: australiaeast
scope: resourceGroup
resource-group-name: rg-funcs-logging-australiaeast
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
template-file: ./infra/main.bicep
action-on-unmanage-resources: delete
deny-settings-mode: none
build-and-deploy:
needs: infrastructure
permissions:
contents: read
id-token: write
strategy:
matrix:
include:
- DOTNET_VERSION: "8.0.x"
directory: net8
- DOTNET_VERSION: "9.0.x"
directory: net9
runs-on: ubuntu-latest
environment: dev
steps:
- name: "Checkout GitHub Action"
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup DotNet ${{ matrix.DOTNET_VERSION}} Environment
uses: actions/setup-dotnet@v5
with:
dotnet-version: ${{ matrix.DOTNET_VERSION}}
- name: "Build .NET"
working-directory: ${{ matrix.directory }}
run: |
dotnet publish Func --output $RUNNER_TEMP/output
dotnet publish FuncWithSerilog --output $RUNNER_TEMP/output-serilog
- name: "Login via Azure CLI"
uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: "Publish Azure Functions ${{ matrix.directory}}"
uses: Azure/functions-action@v1
with:
app-name: func-funcs-${{ matrix.directory}}-logging-australiaeast
package: "${{ runner.temp }}/output"
- name: "Publish Azure Functions ${{ matrix.directory}} with Serilog"
uses: Azure/functions-action@v1
with:
app-name: func-funcs-${{ matrix.directory}}-serilog-logging-australiaeast
package: "${{ runner.temp }}/output-serilog"