Skip to content

Commit

Permalink
ci: update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SondreJDigdir committed Jan 28, 2025
1 parent 75bf48d commit 5acf8d4
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions .github/workflows/build-deploy-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,46 @@ on:

env:
AZURE_FUNCTIONAPP_NAME: 'func-mtam-emu-staging' # set this to your function app name on Azure
AZURE_FUNCTIONAPP_PACKAGE_PATH: '.' # set this to the path to your function app project, defaults to the repository root
DOTNET_VERSION: '8.0.x' # set this to the dotnet version to use (e.g. '2.1.x', '3.1.x', '5.0.x')

jobs:
build-and-deploy:
build:
runs-on: ubuntu-latest
environment: dev
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v3

- name: Setup DotNet ${{ env.DOTNET_VERSION }} Environment
uses: actions/setup-dotnet@v3
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: 'Resolve Project Dependencies Using Dotnet'
shell: bash
- name: 'Dotnet restore, build & test'
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
dotnet restore
dotnet build --no-restore
dotnet test --no-build --verbosity normal
working-directory: ./
- name: Dotnet build and publish Function App with configuration 'Release'
run: |
dotnet build --configuration 'Release'
dotnet publish -c 'Release' --no-restore -o './published-app'
working-directory: MtamFunction
- name: Upload artifact 'mtam-function'
uses: actions/upload-artifact@v4
with:
name: mtam-function
path: MtamFunction/published-app
include-hidden-files: true

deploy:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- name: 'Download artifact for staging'
uses: actions/download-artifact@v4
with:
name: mtam-function
path: './downloaded-app'
- name: 'Deploy artifact to staging'
uses: azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
package: '${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}/output'
publish-profile: ${{ secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE }}
app-name: ${{env.AZURE_FUNCTIONAPP_NAME}}
package: './downloaded-app'
publish-profile: ${{secrets.AZURE_FUNCTIONAPP_PUBLISH_PROFILE}}

0 comments on commit 5acf8d4

Please sign in to comment.