Skip to content

Commit

Permalink
Add GitHub Actions workflow for .NET Core Azure deployment
Browse files Browse the repository at this point in the history
Added a new GitHub Actions workflow configuration in the
`azureprojectgenerator.yml` file to automate the build and
deployment of a .NET Core application to an Azure Function App.
The workflow triggers on push events to the `generatesmallerprojects`
branch and includes environment variable setup, build, and deploy
jobs. The build job handles dependency restoration, project build,
and artifact upload, while the deploy job manages the deployment
to Azure.
  • Loading branch information
madebygps committed Sep 4, 2024
1 parent d98e8a3 commit d6fac55
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/azureprojectgenerator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build and deploy .NET Core application to Function App azureprojectgenerator
on:
push:
branches:
- generatesmallerprojects
env:
AZURE_FUNCTIONAPP_NAME: azureprojectgenerator
AZURE_FUNCTIONAPP_PACKAGE_PATH: azure-project-generator/published
CONFIGURATION: Release
DOTNET_CORE_VERSION: 8.0.x
WORKING_DIRECTORY: azure-project-generator
DOTNET_CORE_VERSION_INPROC: 6.0.x
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION }}
- name: Setup .NET Core (for inproc extensions)
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_CORE_VERSION_INPROC }}
- name: Restore
run: dotnet restore "${{ env.WORKING_DIRECTORY }}"
- name: Build
run: dotnet build "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-restore
- name: Publish
run: dotnet publish "${{ env.WORKING_DIRECTORY }}" --configuration ${{ env.CONFIGURATION }} --no-build --output "${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}"
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: functionapp
path: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: functionapp
path: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}
- name: Deploy to Azure Function App
uses: Azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
publish-profile: ${{ secrets.azureprojectgenerator_A149 }}
package: ${{ env.AZURE_FUNCTIONAPP_PACKAGE_PATH }}

0 comments on commit d6fac55

Please sign in to comment.