Add capability to add a framework switch and also make sure to return… #58
Workflow file for this run
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: release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup dotnet 6.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "6.0.x" | |
- name: Setup dotnet 8.0.x | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "8.0.x" | |
- uses: nowsprinting/check-version-format-action@v3 | |
id: version | |
with: | |
prefix: 'v' | |
- uses: nuget/setup-nuget@v2 | |
- run: nuget restore NuGetUtility.sln | |
- name: Add msbuild to PATH | |
uses: microsoft/setup-msbuild@v2 | |
- name: build | |
run: msbuild -t:rebuild -property:Configuration=Release | |
- uses: browser-actions/setup-chrome@latest | |
- name: test | |
uses: josepho0918/vstest-action@main | |
with: | |
testAssembly: "NuGetUtility.Test.dll" | |
searchFolder: "tests/NuGetUtility.Test/bin/Release/net8.0/" | |
runInParallel: true | |
- name: fully qualify artifacts path | |
id: artifacts_path | |
shell: pwsh | |
run: | | |
$path = [System.IO.Path]::GetFullPath("./artifacts"); | |
echo "publish to path: $path" | |
echo "path=$path" >> $env:GITHUB_OUTPUT | |
- name: Publish the application binaries (.net6) | |
run: dotnet publish ./src/NuGetLicenseCore/NuGetLicenseCore.csproj -c Release --no-restore -o ${{ steps.artifacts_path.outputs.path }}/net6 -f net6.0 -p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Publish the application binaries (.net8) | |
run: dotnet publish ./src/NuGetLicenseCore/NuGetLicenseCore.csproj -c Release --no-restore -o ${{ steps.artifacts_path.outputs.path }}/net8 -f net8.0 -p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Publish the application binaries (.net472) | |
run: msbuild ./src/NuGetLicenseFramework/NuGetLicenseFramework.csproj /t:Publish /p:configuration=Release /p:PublishDir=${{ steps.artifacts_path.outputs.path }}/net472 /p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Create nuget package | |
run: dotnet pack ./src/NuGetLicenseCore/NuGetLicenseCore.csproj -c Release --no-build -o ${{ steps.artifacts_path.outputs.path }} -p:Version=${{ steps.version.outputs.full_without_prefix }} | |
- name: Zip artifacts | |
uses: thedoctor0/[email protected] | |
with: | |
type: 'zip' | |
filename: 'release.zip' | |
path: ${{ steps.artifacts_path.outputs.path }} | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
prerelease: ${{ steps.version.outputs.prerelease != '' }} | |
generate_release_notes: true | |
fail_on_unmatched_files: true | |
files: | | |
release.zip | |
- name: publish nuget package to nuget.org | |
id: publish_nuget | |
shell: pwsh | |
run: | | |
$files = Get-ChildItem -Path ${{ steps.artifacts_path.outputs.path }}/* -Include *.nupkg -Recurse | |
foreach ($f in $files){ | |
$fullPath = $F.FullName | |
echo "sending $fullPath" | |
dotnet nuget push "$fullPath" -s 'https://api.nuget.org/v3/index.json' -k ${{ secrets.NUGET_KEY }} --skip-duplicate | |
} |