updated demo app to use .net 8 #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
defaults: | |
run: | |
working-directory: "Benday.Demo123" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
AZURE_WEBAPP_NAME: bdcgithubactiondemo # set this to your application's name | |
AZURE_WEBAPP_PACKAGE_PATH: 'Benday.Demo123/src/Benday.Demo123.WebUi' # set this to the path to your web app project, defaults to the repository root | |
PROJECT_TO_PUBLISH_PATH: 'Benday.Demo123/src/Benday.Demo123.WebUi' | |
PROJECT_TO_PUBLISH_PATH_2: 'Benday.Demo123/src/Benday.Demo123.Api' | |
DOTNET_VERSION: '8.*' # set this to the dot net version to use | |
# | |
# I really want to do this but it doesn't seem to work | |
# PUBLISH_TO_PATH: '$RUNNER_WORKSPACE/published' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# runs-on: self-hosted | |
services: | |
sqlserver: | |
image: mcr.microsoft.com/mssql/server:2019-latest | |
env: | |
ACCEPT_EULA: Y | |
SA_PASSWORD: Pa$$word | |
MSSQL_PID: Standard | |
ports: | |
- 1433:1433 | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.npm | |
key: npm-packages-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: npm-packages- | |
- name: print environment vars | |
run: env | |
- name: print default working directory | |
run: pwd | |
- name: run an ls -l | |
run: ls -lR | |
working-directory: '${{ github.workspace }}' | |
- name: Inspect contexts | |
run: | | |
echo "" | |
echo "The github context is:" | |
echo "${{ toJson(github) }}" | |
echo "" | |
echo "The job context is:" | |
echo "${{ toJson(job) }}" | |
echo "" | |
echo "The steps context is:" | |
echo "${{ toJson(steps) }}" | |
echo "" | |
echo "The runner context is:" | |
echo "${{ toJson(runner) }}" | |
echo "" | |
echo "The strategy context is:" | |
echo "${{ toJson(strategy) }}" | |
echo "" | |
echo "The matrix context is:" | |
echo "${{ toJson(matrix) }}" | |
echo "" | |
# | |
# | |
# Here is the workaround for my env variable wish | |
- name: set environment variable for publishing path for webui project | |
run: echo "PUBLISH_TO_PATH=$GITHUB_WORKSPACE/webui-published" >> $GITHUB_ENV | |
- name: set environment variable for publishing path for api project | |
run: echo "PUBLISH_TO_PATH_2=$GITHUB_WORKSPACE/api-published" >> $GITHUB_ENV | |
- name: print environment vars again | |
run: env | |
# - name: Setup .NET Core | |
# uses: actions/setup-dotnet@v1 | |
# with: | |
# dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: Restore dotnet tools | |
run: dotnet tool restore | |
- name: Install dependencies for .net core | |
run: dotnet restore | |
- name: edit connection string | |
uses: benday-inc/edit-dbconnstr-in-appsettings@v1.1 | |
with: | |
pathtosettingsfile: '${{ github.workspace }}/Benday.Demo123/src/Benday.Demo123.WebUi/appsettings.json' | |
name: "default" | |
connectionstring: "default conn string 123" | |
- name: Edit property string value in appsettings.json | |
uses: benday-inc/set-property-value-in-appsettings@v1.1 | |
with: | |
pathtosettingsfile: '${{ github.workspace }}/Benday.Demo123/src/Benday.Demo123.WebUi/appsettings.json' | |
keyname1: 'keylevel1' | |
keyname2: 'keylevel2' | |
keyname3: 'keylevel3' | |
valuetoset: 'asdf asdf' | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Deploy database migrations to container | |
run: dotnet ef database update | |
working-directory: '${{ github.workspace }}/Benday.Demo123/src/Benday.Demo123.Api' | |
- name: Test | |
run: dotnet test --no-restore --verbosity normal | |
- name: Publish the web project | |
run: dotnet publish --configuration Release -o '${{ env.PUBLISH_TO_PATH }}' | |
working-directory: '${{ env.PROJECT_TO_PUBLISH_PATH }}' | |
- name: Publish the api project | |
run: dotnet publish --configuration Release -o '${{ env.PUBLISH_TO_PATH_2 }}' | |
working-directory: '${{ env.PROJECT_TO_PUBLISH_PATH_2 }}' | |
- name: publish artifact for web ui | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-output | |
path: '${{ env.PUBLISH_TO_PATH }}' | |
- name: publish artifact for api project | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-output-api-project | |
path: '${{ env.PUBLISH_TO_PATH_2 }}' |