Skip to content

Publish

Publish #10

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
feed:
description: NuGet feed
required: true
default: Staging
type: choice
options:
- Production
- Staging
version:
description: Library version
required: true
default: 1.1.2
type: string
jobs:
publish:
name: Test and publish
runs-on: ubuntu-latest
env:
BUILD_CONFIG: Release
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
- name: Install dependencies
run: dotnet restore
- name: Build
run: |
dotnet build -c ${{ env.BUILD_CONFIG }} --no-restore \
-p:Commit=${{ github.sha }} \
-p:Version=${{ github.event.inputs.version }}
# - name: Test
# run: dotnet test . -c ${{ env.BUILD_CONFIG }} --no-build
- name: Publish
run: |
dotnet pack . -c ${{ env.BUILD_CONFIG }} --no-build -p:Version=${{ github.event.inputs.version }}
dotnet nuget push **/*.nupkg \
-k ${{ github.event.inputs.feed == 'Production' && secrets.NUGET_API_KEY || secrets.NUGETTEST_API_KEY }} \
-s ${{ github.event.inputs.feed == 'Production' && 'https://api.nuget.org/v3/index.json' || 'https://apiint.nugettest.org/v3/index.json' }}