Skip to content

change action name, add environment, add need on test #41

change action name, add environment, add need on test

change action name, add environment, add need on test #41

name: Build, Test and Deploy
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]
env:
DOTNET_VERSION: '8.0.x'
AZURE_FUNCTIONAPP_NAME: 'LuasAPIFunction'
AZURE_FUNCTIONAPP_PACKAGE_PATH: './LuasAPI.AzureFunction'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
build-and-deploy:
runs-on: ubuntu-latest
needs: build-and-test
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 build --configuration Release --output ./output
popd
- name: 'Run Azure Functions Action'
uses: Azure/functions-action@v1
id: fa
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}