-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (95 loc) · 2.71 KB
/
AzureFunction.yaml
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
106
107
108
109
name: Function CI/CD
run-name: ${{ github.actor }} is testing out Azure Function GitHub Actions 🚀
on:
push:
branches:
- main
- '!feature/**'
paths:
- 'src/AzureFunction/**'
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
pull_request:
branches:
- main
- '!feature/**'
paths:
- 'src/AzureFunction/**'
env:
app_full_path: ./src/AzureFunction/DEPLOY.BikeApp.Function/DEPLOY.BikeApp.Function.csproj
app_path: ./src/AzureFunction/DEPLOY.BikeApp.Function
app_root: ./src/AzureFunction/
app_name: func-apim-bike-api-lab
jobs:
build:
# environment: lab
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: ['8.0.x']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
steps:
- uses: actions/checkout@v4
- name: Setup dotnet ${{ matrix.dotnet-version }}
uses: actions/[email protected]
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Install dependencies
run: |
cd ${{ env.app_path }}
dotnet restore
dotnet build --configuration Release --output ./output
# - name: 'Build'
# shell: bash
# run: |
# pushd ${{ env.app_path }}
# dotnet build --configuration Release --output ./output
# popd
- name: 'Publish Artifact for Azure Functions'
uses: actions/upload-artifact@v4
with:
name: function-artifact
path: ${{ env.app_path }}/output'
retention-days: 5
overwrite: true
compression-level: 9
deploy:
if: ${{ github.event_name != 'pull_request' }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Log in to Azure
uses: azure/[email protected]
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Download Artifact for Azure Functions
uses: actions/download-artifact@v4
with:
name: function-artifact
path: ${{ env.app_path }}/output
- name: Verificando o download do artefato
run: |
ls
ls -la ${{ env.app_path }}/output
- name: 'Run Azure Functions Action'
uses: Azure/[email protected]
id: deploy-function-app
with:
app-name: ${{ env.app_name }}
slot-name: 'production'
publish-profile: ${{ secrets.FUNCTION_PUBLISH_PROFILE }}
package: ${{ env.app_path }}/output
- name: Log out from Azure
run: |
az logout