Migration from Spring #91
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: dotnet | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.txt' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.txt' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
DOTNET_NOLOGO: true | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # avoid shallow clone so nbgv can do its work. | |
- uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: '5.8' | |
- uses: microsoft/setup-msbuild@v1 | |
- uses: dotnet/[email protected] | |
with: | |
setAllVars: true | |
- uses: actions/cache@v1 | |
id: cache | |
with: | |
path: ~/.nuget/packages | |
key: nuget-${{ runner.os }}-${{ hashFiles('**/packages.lock.json') }} | |
- name: nuget restore | |
run: nuget restore -NonInteractive | |
- name: msbuild | |
run: msbuild Unravel.sln /p:Configuration=Release /verbosity:normal /t:Rebuild | |
- name: dotnet test | |
run: dotnet test --nologo --no-build --configuration Release | |
- name: Start IIS Express | |
run: | | |
$URL = .\util\Start-IisExpress.ps1 -Path .\examples\Web | |
if (!$URL) { exit 1 } | |
"URL=$URL" | Out-File -Append -Encoding utf8 -FilePath $Env:GITHUB_ENV | |
- name: Check Connection | |
run: | | |
curl --insecure --show-error --silent $Env:URL/AspNetMvc | |
curl --insecure --show-error --silent $Env:URL/AspNetMvc/View | |
curl --insecure --show-error --silent $Env:URL/AspNetWebApi | |
curl --insecure --show-error --silent $Env:URL/AspNetCoreApi | |
curl --insecure --show-error --silent $Env:URL/AspNetCoreMvc | |
curl --insecure --show-error --silent $Env:URL/AspNetCoreMvc/View | |
- name: dotnet pack | |
run: dotnet pack --configuration Release --no-build --output artifacts/ | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: packages | |
path: artifacts/ | |
- name: dotnet nuget add source --name github | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.url == github.event.pull_request.base.repo.url | |
env: | |
SOURCE_URL: ${{ format('https://nuget.pkg.github.com/{0}/index.json', github.repository_owner) }} | |
run: | | |
dotnet nuget remove source ${{ env.SOURCE_URL }} > $null | |
dotnet nuget add source --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github ${{ env.SOURCE_URL }} | |
dotnet nuget list source | |
- name: dotnet nuget push --source github | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.url == github.event.pull_request.base.repo.url | |
working-directory: artifacts | |
run: dotnet nuget push --source github *.nupkg | |
- name: dotnet nuget push | |
if: github.event_name == 'push' && github.ref_name == 'main' | |
working-directory: artifacts | |
env: | |
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY }} | |
SOURCE_URL: https://api.nuget.org/v3/index.json | |
run: dotnet nuget push --source ${{ env.SOURCE_URL }} --api-key ${{ env.NUGET_AUTH_TOKEN }} *.nupkg |