You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 26, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+26-21Lines changed: 26 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,52 +2,57 @@
2
2
GitHub action to build, pack & publish nuget packages automatically when a project version is updated
3
3
4
4
## Usage
5
-
Create a new `.github/workflows/publish-nuget.yml` file:
5
+
Create new `.github/workflows/publish.yml` file:
6
6
7
-
```yaml
7
+
```yml
8
8
name: publish to nuget
9
9
on:
10
10
push:
11
11
branches:
12
12
- master # Your default release branch
13
13
jobs:
14
14
publish:
15
-
name: publish to nuget
15
+
name: list on nuget
16
16
runs-on: ubuntu-latest
17
17
steps:
18
-
# Checkout
19
18
- uses: actions/checkout@v2
20
19
21
-
#Optional step, add only for a specific dotnet version that doesn't come with ubuntu-latest / windows-latest
22
-
# Visit bit.ly/2synnZl for a list of software that comes pre-installed with ubuntu-latest / windows-latest
20
+
#Required for a specific dotnet version that doesn't come with ubuntu-latest / windows-latest
21
+
# Visit bit.ly/2synnZl to see the list of SDKs that are pre-installed with ubuntu-latest / windows-latest
23
22
# - name: Setup dotnet
24
23
# uses: actions/setup-dotnet@v1
25
24
# with:
26
25
# dotnet-version: 3.1.100
27
26
28
27
# Publish
29
-
- name: Publish if version is updated
30
-
uses: rohith/publish-nuget@v1
31
-
# with: # All inputs are optional (details given below)
32
-
# project_dir: src # Defaults to repository root
33
-
# tag_format: v* # [*] gets replaced with version
34
-
# nuget_key: ${{secrets.NUGET_API_KEY}} # nuget.org API key
28
+
- name: publish on version change
29
+
uses: rohith/publish-nuget@v2
30
+
with:
31
+
PROJECT_FILE_PATH: Core/Core.csproj # Relative to repository root
32
+
# VERSION_FILE_PATH: Directory.Build.props # Filepath with version info, relative to repository root. Defaults to project file
33
+
# VERSION_REGEX: <Version>(.*)<\/Version> # Regex pattern to extract version info in a capturing group
34
+
# TAG_COMMIT: true # Flag to enable / disalge git tagging
35
+
# TAG_FORMAT: v* # Format of the git tag, [*] gets replaced with version
36
+
# NUGET_KEY: ${{secrets.NUGET_API_KEY}} # nuget.org API key
35
37
```
36
38
37
-
-Project version updates are monitored on every push / PR merge to master & a new tag is created to denote the updated version
38
-
- If a `nuget_key` is present then the project gets built, packed & published to nuget.org
39
+
-With all settings on default, updates to project version are monitored on every push / PR merge to master & a new tag is created
40
+
- If a `NUGET_KEY` is present then the project gets built, packed & published to nuget.org
39
41
40
42
## Inputs
41
-
All these inputs are optional
43
+
Most of the inputs are optional
42
44
43
-
Input | Description
44
-
--- | ---
45
-
project_dir | Directory path containing the project file, defaults to repository root
46
-
tag_format | Defaults to `v*` - `[*]` is a placeholder for the actual project version
47
-
nuget_key | API key to authorize the package upload to nuget.org
45
+
Input | Default Value | Description
46
+
--- | --- | ---
47
+
PROJECT_FILE_PATH | | File path of the project to be packaged, relative to repository root
48
+
VERSION_FILE_PATH | `[PROJECT_FILE_PATH]` | File path containing version info, relative to repository root
49
+
VERSION_REGEX | `<Version>(.*)<\/Version>` | Regex pattern to extract version info in a capturing group
50
+
TAG_COMMIT | `true` | Flag to enable / disable git tagging
51
+
TAG_FORMAT | `v*` | `[*]` is a placeholder for the actual project version
52
+
NUGET_KEY | | API key to authorize the package upload to nuget.org
48
53
49
54
**Note:**
50
-
`project_dir` & `tag_format` have default values but a package cannot be published without the `nuget_key`
55
+
For multiple projects, every input except `PROJECT_FILE_PATH` can be given as `env` variable at [job / workflow level](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env)
0 commit comments