Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCC-245: Add the option to publish without Microsoft.SourceLink.GitHub #378

Merged
merged 11 commits into from
Jul 27, 2024
14 changes: 13 additions & 1 deletion .github/actions/publish-nuget/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ inputs:
https://github.com/actions/upload-artifact#retention-period for more details. Note that this only affects the
retention of the workflow run's artifact, not the artifacts attached to the release created on GitHub; those will
remain indefinitely.
add-source-link-package:
required: false
default: 'true'
description: If set to "true", the Microsoft.SourceLink.GitHub NuGet package is added to the projects.

runs:
using: composite
Expand Down Expand Up @@ -114,7 +118,15 @@ runs:
# This also implicitly restores NuGet dependencies.
- name: Add Source Link package
shell: pwsh
run: Add-SourceLinkPackage
run: |
if ('${{ inputs.add-source-link-package }}' -eq 'true')
{
Add-SourceLinkPackage
Piedone marked this conversation as resolved.
Show resolved Hide resolved
}
else
{
dotnet restore -p:NuGetBuild=true
}
sarahelsaig marked this conversation as resolved.
Show resolved Hide resolved

- name: Update package manifest version
shell: pwsh
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ on:
https://github.com/actions/upload-artifact#retention-period for more details. Note that this only affects the
retention of the workflow run's artifact, not the artifacts attached to the release created on GitHub; those
will remain indefinitely.
add-source-link-package:
type: string
default: 'true'
description: If set to "true", the Microsoft.SourceLink.GitHub NuGet package is added to the projects.

jobs:
publish-nuget:
Expand All @@ -75,14 +79,15 @@ jobs:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Publish to NuGet
uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@dev
uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@issue/OCC-245
with:
source: ${{ inputs.source }}
verbosity: ${{ inputs.verbosity }}
dotnet-pack-ignore-warning: ${{ inputs.dotnet-pack-ignore-warning }}
dotnet-pack-include-symbols: ${{ inputs.dotnet-pack-include-symbols }}
publish-version: ${{ inputs.publish-version }}
nuget-artifact-retention-days: ${{ inputs.nuget-artifact-retention-days }}
add-source-link-package: ${{ inputs.add-source-link-package }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API_KEY: ${{ secrets.API_KEY }}
Expand Down
Loading