This repository contains a simple web application that can be deployed to Azure App Service using Github Actions.
There are two actions defined in .github/workflows
directory:
build.yml
- builds the application and sets version inappsettings.json
file.deploy.yml
- publishes the application to Azure App Service;
Both actions are triggered manually.
To facilitate the deployment process, two scripts are provided:
create-azure-resources.ps1
- creates Azure resources required for the deployment;delete-azure-resources.ps1
- deletes Azure resources created bycreate-azure-resources.ps1
script.
az login
cd scripts
./create-azure-resources.ps1
- Download publish profile from Azure App Service;
- Copy contents of publish profile to new Github secret named
AZURE_DEMO_PUBLISH_PROFILE
;
- Run Github action named 'Build' (if it wasn't run before);
- Run Github action named 'Deploy' (requires an artifact generated by step #3).
cd scripts
./delete-azure-resources.ps1
Another project is a 'SharedPackage' that is packed into a nuget package and published to Github Packages.
Make sure package project has all the settings needed in .csproj
file.
<PackageId>AwesomePrivatePackage</PackageId>
<Version>1.0.6</Version>
<Authors>Anthony Maisak</Authors>
<Description>A sample class library</Description>
<PackageTags>sample</PackageTags>
<RepositoryUrl>https://github.com/maisak/actions</RepositoryUrl>
Pack it
cd SharedPackage
dotnet build
dotnet pack -c Release
Publish it
dotnet nuget add source --username maisak --password <PAT> --store-password-in-clear-text --name github-maisak "https://nuget.pkg.github.com/maisak/index.json"
dotnet nuget push .\bin\Release\AwesomePrivatePackage.1.0.6.nupkg -s github-maisak