-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (79 loc) · 2.22 KB
/
CI-CD-Feedpoller-function.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
name: CI/CD feedpoller-func
on:
push:
branches:
- main
env:
DOTNET_VERSION: '6.0.x' # Global environment variables
TEST_FUNC_NAME: 'oed-test-feedpoller-func'
PROD_FUNC_NAME: 'oed-feedpoller-func'
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: GitHub metadata
run: |
echo "$GITHUB_REPOSITORY on $GITHUB_REF_NAME by $GITHUB_ACTOR"
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet publish -c Release -o ./publish
- name: Run Tests
run: dotnet test --verbosity normal
- name: Upload Build Artifacts
uses: actions/upload-artifact@v3
with:
name: published-artifacts
path: ./publish/
deploy-to-test:
name: Deploy to Test Environment
needs: build
runs-on: ubuntu-latest
environment:
name: test
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
name: published-artifacts
path: ./publish/
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: '${{ env.TEST_FUNC_NAME }}'
slot-name: 'Production'
package: ./publish/
publish-profile: ${{ secrets.PUBLISH_PROFILE }}
deploy-to-prod:
name: Deploy to Production Environment
needs: deploy-to-test
runs-on: ubuntu-latest
environment:
name: production
steps:
- name: Await Manual Approval
if: ${{ github.ref == 'refs/heads/main' }}
run: |
echo "Waiting for manual approval"
echo "::pause::"
- name: Download Build Artifacts
uses: actions/download-artifact@v3
with:
name: published-artifacts
path: ./publish/
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: deploy-to-function
with:
app-name: '${{ env.PROD_FUNC_NAME}}'
slot-name: 'Production'
package: ./publish/
publish-profile: ${{ secrets.PUBLISH_PROFILE }}