Skip to content

Deploy NuGet Package before Release #27

Deploy NuGet Package before Release

Deploy NuGet Package before Release #27

Workflow file for this run

name: Deploy NuGet Package after Release
on:
workflow_dispatch:
release:
types: [published]
jobs:
deploy-nuget-package:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Set the versions
run: |
echo "NUGET_VERSION=${{ steps.gitversion.outputs.SemVer }}" >> $env:GITHUB_ENV
echo "ASSEMBLY_VERSION=${{ steps.gitversion.outputs.AssemblySemVer }}" >> $env:GITHUB_ENV
echo "FILE_VERSION=${{ steps.gitversion.outputs.AssemblySemVer }}" >> $env:GITHUB_ENV
echo "INFORMATIONAL_VERSION=${{ steps.gitversion.outputs.InformationalVersion }}" >> $env:GITHUB_ENV
- name: Build NuGet package with symbols
run: |
dotnet pack ./src/RxDBDotNet/RxDBDotNet.csproj `
--configuration Release `
--output ./nuget `
/p:Version=$env:NUGET_VERSION `
/p:AssemblyVersion=$env:ASSEMBLY_VERSION `
/p:FileVersion=$env:FILE_VERSION `
/p:InformationalVersion=$env:INFORMATIONAL_VERSION `
/p:IncludeSource=true `
/p:IncludeSymbols=true `
/p:SymbolPackageFormat=snupkg
- name: Publish NuGet package to NuGet.org
run: |
$package = Get-ChildItem -Path ./nuget -Filter RxDBDotNet*.nupkg | Select-Object -First 1
dotnet nuget push $package.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
- name: Display Package Info
run: |
echo "Package files:"
Get-ChildItem -Path ./nuget -Filter RxDBDotNet*.nupkg | Format-Table Name, FullName
Get-ChildItem -Path ./nuget -Filter RxDBDotNet*.snupkg | Format-Table Name, FullName