-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (85 loc) · 3.21 KB
/
amf-functions.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# This is a basic workflow to help you get started with Actions
name: Functions Deployment
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the 'main' branch
push:
paths-ignore:
- "src/AnimeFeedManager.Web**"
- "**/*.md"
branches:
- main
pull_request:
paths-ignore:
- "src/AnimeFeedManager.Web**"
- "**/*.md"
types: [opened, synchronize, reopened, closed]
branches:
- main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_PACKAGE_PATH: "./src/AnimeFeedManager.Functions" # set this to the path to your web app project, defaults to the repository root
TEST_PROJECT_PATH: "./src/AnimeFeedManager.Features.Tests"
DOTNET_VERSION: "8.0.x" # set this to the dotnet version to use
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Updates Azure Infraestructure
build-and-deploy-functions:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout GitHub Action
uses: actions/checkout@v4.1.1
with:
submodules: true
clean: true
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
enable-AzPSSession: true
# Deploys infrastructure
- name: Deploy Azure Infrastructure
uses: Azure/arm-deploy@v1
id: infrastructure
with:
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }}
resourceGroupName: ${{ secrets.AZURE_RG }}
template: ./deployment/main.bicep
parameters: sendgridKey=${{ secrets.SENDGRID_KEY }} email=${{ secrets.SENDER_EMAIL }}
failOnStdErr: false
# Builds and Deploys functions
- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Resolve Project Dependencies Using Dotnet
shell: bash
run: |
pushd '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}'
dotnet publish --configuration Release --output ./output
popd
- name: Test Using Dotnet
shell: bash
run: dotnet test '${{ env.TEST_PROJECT_PATH }}'
- name: Run Azure Functions Action
uses: Azure/functions-action@v1.5.1
id: fa
with:
slot-name: "Production"
app-name: ${{ steps.infrastructure.outputs.appname }}
package: "${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output"
close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_DELIGHTFUL_OCEAN_098A2440F }}
action: "close"