Skip to content

Added new README (#133) #58

Added new README (#133)

Added new README (#133) #58

name: ASP.NET Core CI (Deploy)
on:
push:
branches:
- 'main'
env:
AZURE_WEBAPP_NAME: hagglehaul # set this to your application's name
AZURE_WEBAPP_PACKAGE_PATH: '.' # set this to the path to your web app project, defaults to the repository root
DOTNET_VERSION: '8.0.x' # set this to the dot net version to use
CUR_PROJ_NAME: 'hagglehaul.Server'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repo
- uses: actions/checkout@main
# Setup .NET Core SDK
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
# Run dotnet build and publish
- name: dotnet build and publish
run: |
dotnet restore
dotnet build --configuration Release
dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp'
pwd
# Substitute variables in appsettings.json
- name: appsettings Variable Substitution
uses: microsoft/variable-substitution@v1
with:
files: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/${{ env.CUR_PROJ_NAME }}/myapp/appsettings.json'
env:
HagglehaulDatabase.ConnectionString: ${{ secrets.HH_DB_CONNECTION_STRING }}
JWT.Secret: ${{ secrets.HH_JWT_SECRET }}
Mapbox.AccessToken: ${{ secrets.HH_MAPBOX_SERVER_KEY }}
AzureCommunicationServices.ConnectionString: ${{ secrets.HH_ACS_CONNECTION_STRING }}
# Deploy to Azure Web apps
- name: 'Run Azure webapp deploy action using publish profile credentials'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation
package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/${{ env.CUR_PROJ_NAME }}/myapp'