forked from DeveloperMetrics/DevOpsMetrics
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.55 KB
/
Copy pathci_cd_function.yml
File metadata and controls
49 lines (40 loc) · 1.55 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
name: CI/CD Function
on:
push:
branches: [ main ]
paths:
- "src/DevOpsMetrics.Function/**"
- ".github/workflows/ci_cd_function.yml"
workflow_dispatch:
jobs:
build_deploy:
runs-on: ubuntu-latest
env:
FUNCTION_NAME: 'function-devops-prd-eu-${{ secrets.AZ_RESOURCES_SUFFIX }}'
outputs: # https://stackoverflow.com/questions/59175332/using-output-from-a-previous-job-in-a-new-one-in-a-github-action
Version: ${{ steps.gitversion.outputs.SemVer }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 #fetch-depth is needed for GitVersion
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Build with dotnet
working-directory: src/DevOpsMetrics.Function
run: dotnet build --configuration Release
- name: dotnet publish
working-directory: src/DevOpsMetrics.Function
run: dotnet publish -c Release -o ${{ github.workspace }}/function
- name: Log into Azure
uses: azure/login@v1
with:
creds: '{"clientId":"${{ secrets.AZ_CLIENT_ID }}","clientSecret":"${{ secrets.AZ_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZ_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZ_TENANT_ID }}"}'
- name: Deploy Function to Azure WebApp
uses: Azure/webapps-deploy@v2.2.5
id: deployfunction
with:
app-name: ${{env.FUNCTION_NAME}}
package: ${{ github.workspace }}/function