Large package Metadata exception + feature fix #72
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: .NET | |
on: | |
push: | |
branches: [ master ] | |
paths: | |
- .github/workflows/dotnet.yml | |
- src/* | |
- tests/* | |
pull_request: | |
branches: [ master ] | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- closed | |
workflow_dispatch: | |
inputs: | |
versionSuffix: | |
description: "Version suffix for nupkg" | |
nugetRelease: | |
required: true | |
description: "release? (1/0)" | |
default: '0' | |
verbosity: | |
required: true | |
description: "verbosity of pipeline output" | |
default: 'minimal' | |
configuration: | |
required: true | |
description: "Configuration for builds" | |
default: 'Release' | |
jobs: | |
environment : | |
runs-on: ubuntu-latest | |
outputs: | |
versionSuffix : ${{ steps.defaults.outputs.versionSuffix }} | |
publishRelease : ${{ steps.defaults.outputs.publishRelease }} | |
verbosity : ${{ steps.defaults.outputs.verbosity }} | |
configuration : ${{ steps.defaults.outputs.configuration }} | |
steps: | |
- name: declare default values | |
id: defaults | |
shell: pwsh | |
run: | | |
$automaticTrigger = "$env:GITHUB_EVENT_NAME" -ne "workflow_dispatch" | |
$mergePR = "master|pull_request|closed|true" -eq "${{github.base_ref}}|${{github.event_name}}|${{github.event.action}}|${{github.event.pull_request.merged}}" | |
$publishRelease = ("${{ github.event.inputs.nugetRelease }}" -eq "1") -Or ($automaticTrigger -And $mergePR) | |
Write-Host "publishRelease: $publishRelease, mergePR: $mergePR, automaticTrigger: $automaticTrigger" | |
$versionSuffix = ""; | |
if($automaticTrigger) { | |
if("${{github.base_ref}}" -eq "master") { | |
$versionSuffix = "beta${{github.run_number}}" | |
} else { | |
$versionSuffix = "alpha${{github.run_number}}" | |
} | |
} else { | |
if([string]::IsNullOrEmpty("${{ github.event.inputs.versionSuffix }}") -eq $true){ | |
$versionSuffix = "" | |
} else { | |
$versionSuffix = "${{ github.event.inputs.versionSuffix }}${{github.run_number}}" | |
} | |
} | |
$values = @( | |
@("versionSuffix", $true, "$versionSuffix", "$versionSuffix"), | |
@("publishRelease", $true, "$publishRelease", "$publishRelease"), | |
@("verbosity", $true, "${{ github.event.inputs.verbosity }}", "minimal"), | |
@("configuration", $true, "${{ github.event.inputs.configuration }}", "Release") | |
) | |
foreach($pair in $values){ | |
$value = $pair[2] | |
if($pair[1] -eq $true -And [string]::IsNullOrEmpty("$value") -eq $true){ | |
$value = $pair[3] | |
} | |
Write-Host "Assigning $($pair[0]) => $value" | |
echo "$($pair[0])=$value" >> $env:GITHUB_OUTPUT | |
} | |
build: | |
runs-on: ubuntu-latest | |
needs: environment | |
env: | |
versionSuffix : ${{ needs.environment.outputs.versionSuffix }} | |
publishRelease : ${{ needs.environment.outputs.publishRelease }} | |
verbosity : ${{ needs.environment.outputs.verbosity }} | |
configuration : ${{ needs.environment.outputs.configuration }} | |
steps: | |
- uses: actions/[email protected] | |
- name: Setup .NET 5,6,7 | |
uses: actions/[email protected] | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
8.0.x | |
#- name: stop | |
# run: exit 1 | |
- name: Restore dependencies | |
run: dotnet restore src/Unlister.sln | |
- name: Build | |
run: dotnet build src/Unlister.sln --verbosity $verbosity -c $configuration --no-restore | |
- name: Test | |
run: dotnet test src/Unlister.sln --verbosity $verbosity -c $configuration --no-build | |
- name: Pack | |
if: ${{ needs.environment.outputs.publishRelease == 'True' }} | |
run: dotnet pack src/NugetUnlister/NugetUnlister.csproj --verbosity $verbosity -c $configuration -o artifacts/nupkg --no-build /p:VersionSuffix=$versionSuffix | |
- name: Remove snupkg | |
if: ${{ needs.environment.outputs.publishRelease == 'True' }} | |
run: find artifacts/nupkg/ -name "*.snupkg" -type f -delete | |
- name: Release | |
if: ${{ needs.environment.outputs.publishRelease == 'True' }} | |
run: dotnet nuget push "artifacts/nupkg/*.nupkg" -k $NUGETKEY -s https://api.nuget.org/v3/index.json | |
env: | |
NUGETKEY: ${{ secrets.NUGET }} | |