Skip to content

Merge pull request #47 from Nodsoft/develop #81

Merge pull request #47 from Nodsoft/develop

Merge pull request #47 from Nodsoft/develop #81

Workflow file for this run

name: Publish NuGet packages
permissions:
contents: write
packages: write
id-token: write
attestations: write
# Controls when the action will run.
on:
push:
branches:
- main
# - develop
- v*
paths-ignore:
- 'nodsoft_moltenobsidian_web/**'
- 'nodsoft_moltenobsidian_ssg_client/**'
- 'Samples/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-test:
uses: ./.github/workflows/build.yml
publish-nuget:
name: Publish NuGet package
runs-on: ubuntu-latest
needs:
- build-test
strategy:
fail-fast: false
matrix:
# Sources to publish to
nuget: [
{ name: "NuGet", source: "https://api.nuget.org/v3/index.json", keyname: "NUGET_TOKEN" },
{ name: "GitHub Packages", source: "https://nuget.pkg.github.com/Nodsoft", keyname: "GITHUB_TOKEN" }
]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Setup NuGet CLI
uses: NuGet/[email protected]
- uses: dotnet/[email protected]
id: nbgv
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Package
run: dotnet pack -c Release --no-build --include-symbols
- id: is-public-release
uses: ASzc/change-string-case-action@v6
with:
string: ${{ steps.nbgv.outputs.PublicRelease }}
- name: Attest build provenance for .(s)nupkgs
uses: actions/attest-build-provenance@v1
# Only once per package: take nuget provider
if: matrix.nuget.name == 'NuGet'
with:
subject-path: "**/Release/*nupkg"
# Publish
- name: Publish packages to ${{ matrix.nuget.name }}
run: |
dotnet nuget push "**/Release/*.nupkg" \
--source "${{ matrix.nuget.source }}" \
--symbol-source "${{ matrix.nuget.source }}" \
--api-key "${{ secrets[matrix.nuget.keyname] }}" \
--symbol-api-key "${{ secrets[matrix.nuget.keyname] }}" \
--skip-duplicate