publish to nuget #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a basic workflow to help you get started with Actions | |
name: publish to nuget | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '**/*.md' | |
- '**/*.gitignore' | |
- '**/*.gitattributes' | |
- '.github/**/*.*' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
DOTNETVERSION: 8.0 | |
DOTNET_NOLOGO: true # Disable the .NET logo | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience | |
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '${{env.DOTNETVERSION}}' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release | |
- name: Pack | |
run: dotnet pack --configuration Release --no-build | |
publish: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# - name: Set up NuGet CLI | |
# run: dotnet tool install --global NuGet.CommandLine | |
- name: Push NuGet package | |
run: | | |
dotnet nuget push **/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}} | |
# publish: | |
# name: build, pack & publish | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# | |
# # - name: Setup dotnet | |
# # uses: actions/setup-dotnet@v1 | |
# # with: | |
# # dotnet-version: 3.1.200 | |
# | |
# # Publish | |
# - name: publish NotionSharp on nuget on change | |
# id: publish_nuget_notionsharp | |
# uses: rohith/publish-nuget@v2 | |
# with: | |
# # Filepath of the project to be packaged, relative to root of repository | |
# PROJECT_FILE_PATH: NotionSharp/NotionSharp.csproj | |
# | |
# # NuGet package id, used for version detection & defaults to project name | |
# PACKAGE_NAME: Softlion.NotionSharp | |
# | |
# # API key to authenticate with NuGet server | |
# NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
# | |
# - name: publish NotionSharp project templates on nuget on change | |
# id: publish_nuget_notionsharp_projecttemplates | |
# uses: rohith/publish-nuget@v2 | |
# with: | |
# # Filepath of the project to be packaged, relative to root of repository | |
# PROJECT_FILE_PATH: Demos/PackTemplateProjects.csproj | |
# | |
# # NuGet package id, used for version detection & defaults to project name | |
# PACKAGE_NAME: Softlion.NotionSharp.TemplateProjects | |
# | |
# # API key to authenticate with NuGet server | |
# NUGET_KEY: ${{secrets.NUGET_API_KEY}} |