Skip to content

Merge pull request #35 from M-Files/dependabot/nuget/MFaaP.MFWSClient… #19

Merge pull request #35 from M-Files/dependabot/nuget/MFaaP.MFWSClient…

Merge pull request #35 from M-Files/dependabot/nuget/MFaaP.MFWSClient… #19

Workflow file for this run

name: Publish to nuget
on:
push:
branches: [ release, prerelease ]
jobs:
build:
timeout-minutes: 15
runs-on: 'windows-2022'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: versionSuffix
shell: pwsh
run: |
$versionSuffix = '${{ github.event.inputs.versionSuffix }}'
If([string]::IsNullOrEmpty($versionSuffix))
{
$versionSuffix = '${{ github.ref_name }}'
}
$versionSuffix = '-' + ($versionSuffix -replace '[^a-zA-Z0-9]','-')
If($versionSuffix -eq '-release')
{
$versionSuffix = ''
}
If(('-', '-master', '-main') -eq $versionSuffix)
{
$versionSuffix = '-prerelease'
}
echo "versionSuffix=$versionSuffix" | Out-File -FilePath $Env:GITHUB_ENV -Append
- name: Get version number
shell: pwsh
run: |
If([string]::IsNullOrEmpty({{ env.versionSuffix }}))
{
# No suffix. Fine.
$versionNumber = Get-Date -Format "yy.M.${{ github.run_number }}"
}
else
{
# Suffix; ensure we add .0 in version number to stop them appearing above full releases.
$versionNumber = Get-Date -Format "yy.M.0.${{ github.run_number }}"
}
echo "versionNumber=$versionNumber${{ env.versionSuffix }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Setup MSBuild path
uses: microsoft/[email protected]
with:
vs-version: '[17.0,)'
- name: Setup dot net
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
3.1.x
5.0.x
6.0.x
7.0.x
8.0.x
- name: Build with dotnet
run: dotnet build ./MFaaP.MFWSClient/MFaaP.MFWSClient.csproj --configuration Release -p:Version=${{ env.versionNumber }}
- name: Create nuget package
run: dotnet pack ./MFaaP.MFWSClient/MFaaP.MFWSClient.csproj --configuration Release -p:Version=${{ env.versionNumber }}
- name: Push with dotnet
run: dotnet nuget push ./MFaaP.MFWSClient/bin/Release/MFaaP.MFWSClient.${{ env.versionNumber }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate