forked from Lombiq/GitHub-Actions
-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (88 loc) · 3.73 KB
/
publish-nuget.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Publish to NuGet
on:
workflow_call:
secrets:
CHECKOUT_TOKEN:
required: false
description: >
The GitHub token to authenticate checkout. Pass in a GitHub personal access token if authenticated submodules
are used.
# We can't access org secrets here so they need to be passed in.
API_KEY:
required: true
inputs:
cancel-workflow-on-failure:
description: When set to "true", it will cancel the current workflow run with all jobs if this workflow fails.
type: string
default: 'true'
source:
type: string
default: https://api.nuget.org/v3/index.json
description: The NuGet server URL used by the `dotnet nuget push` command's `--source` argument.
verbosity:
type: string
default: minimal
description: The logging verbosity type used by the `dotnet` command.
dotnet-version:
type: string
default: 8.0.x
description: Version of the .NET SDK to set up.
timeout-minutes:
type: number
default: 15
description: Configuration for the timeout-minutes parameter of the workflow. The 360 is GitHub's default.
dotnet-pack-ignore-warning:
type: string
default: ''
description: >
Additional warning codes for the `-p:NoWarn=` argument of `dotnet pack`. The items can be separated by any
whitespace, including newlines.
dotnet-pack-include-symbols:
type: string
default: 'true'
description: If set to "true", a symbol package will be created together with the NuGet package.
publish-version:
type: string
default: 'USE_GITHUB_REF_NAME'
description: >
The desired NuGet package version used for publishing. The correct format is "vM.N.O" or
"vM.N.O-alpha.X.<issue-code>". If not specified, the GITHUB_REF_NAME environment variable is used
which is suitable if the version is derived from a git tag.
nuget-artifact-retention-days:
type: string
default: '14'
description: >
Duration in days after which the artifact of the NuGet package publishing (if any) will expire. See
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.
jobs:
publish-nuget:
runs-on: ubuntu-22.04
timeout-minutes: ${{ inputs.timeout-minutes }}
steps:
- name: Checkout
uses: Lombiq/GitHub-Actions/.github/actions/checkout@dev
with:
token: ${{ secrets.CHECKOUT_TOKEN }}
- name: Set up .NET
uses: Lombiq/GitHub-Actions/.github/actions/setup-dotnet@dev
with:
dotnet-version: ${{ inputs.dotnet-version }}
- name: Publish to NuGet
uses: Lombiq/GitHub-Actions/.github/actions/publish-nuget@dev
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 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
API_KEY: ${{ secrets.API_KEY }}
- name: Cancel Workflow on Failure
if: failure() && inputs.cancel-workflow-on-failure == 'true'
uses: Lombiq/GitHub-Actions/.github/actions/cancel-workflow@dev
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}