Skip to content

WrapThat.TheAnswer.Nuget #14

WrapThat.TheAnswer.Nuget

WrapThat.TheAnswer.Nuget #14

name: WrapThat.TheAnswer.Nuget
on:
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
defaults:
run:
shell: pwsh
jobs:
publish:
name: Build, pack & publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore --verbosity normal
# Publish
# Create the NuGet package in the package folder
- name: Pack
run: dotnet pack --configuration Release --no-build --output package
# Publish the NuGet package as an artifact, so they can be used in the following jobs
#- uses: actions/upload-artifact@v3
# with:
# name: nuget
# if-no-files-found: error
# retention-days: 7
# path: ${{ package}}/*.nupkg
- name: Publish nupkg and snupkg to NuGet.org
run: |
foreach($file in (Get-ChildItem package -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.WRAPTHATNUGET }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}
foreach($file in (Get-ChildItem "package" -Recurse -Include *.snupkg)) {
dotnet nuget push $file --api-key "${{ secrets.WRAPTHATNUGET }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}