🛠️ Scoping authentication scripts security own pages #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: AFM Backend 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**" | |
- 'deployment/*' | |
- '!deployment/main-functions.bicep' | |
- "**/*.md" | |
branches: | |
- main | |
pull_request: | |
paths-ignore: | |
- "src/AnimeFeedManager.Web**" | |
- 'deployment/*' | |
- '!deployment/main-main-functions.bicep' | |
- "**/*.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: | |
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.6.1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
enable-AzPSSession: true | |
# Get variables from infrastructure | |
- name: Get variables from infrastructure | |
uses: Azure/arm-deploy@v1 | |
id: infrastructure | |
with: | |
scope: resourcegroup | |
subscriptionId: ${{ secrets.AZURE_SUBSCRIPTION }} | |
resourceGroupName: ${{ secrets.AZURE_RG }} | |
template: ./deployment/main-functions.bicep | |
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" |