Skip to content

Upload to NuGet

Upload to NuGet #4

name: Upload to NuGet
on:
workflow_run:
workflows:
- 'Update Version'
types:
- 'completed'
defaults:
run:
shell: |
pwsh -noninteractive -command "try {{ $ErrorActionPreference='Stop'; . '{0}' }} catch {{ Write-Error ""FAILED: $_""; throw; }} if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) {{ exit $LASTEXITCODE }}"
# Configuration Type
env:
BUILD_TYPE: 'Release'
jobs:
build-and-upload-package: # Only run on successful version update action
runs-on: windows-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-dotnet@main
with:
dotnet-version: 6.0.x
- name: Build
run: dotnet build -c Release
- name: Authenticate with Github NuGet Package Registry
run: dotnet nuget add source --username radj307 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/radj307/index.json"
- name: Pack NuGet Package
run: dotnet pack ./XamlTimers.csproj --noLogo -c Release -o . --include-symbols
- name: Upload NuGet Package
run: foreach ($pkg in $(Get-ChildItem -Filter *.nupkg)) { dotnet nuget push $pkg.Name -k ${{ github.token }} -s https://nuget.pkg.github.com/radj307/index.json --skip-duplicate ; dotnet nuget push $pkg.Name -k ${{ secrets.NUGET_API_KEY_XAMLTIMERS }} -s https://api.nuget.org/v3/index.json --skip-duplicate }