Skip to content

Commit 83c23e6

Browse files
committed
Add release GitHub workflow
1 parent f436265 commit 83c23e6

3 files changed

Lines changed: 47 additions & 7 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: [v*]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
- name: Run release script
15+
shell: pwsh
16+
run: ./eng/release.ps1
17+
env:
18+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ This library is also used in production by [KnowledgePicker](https://knowledgepi
9292

9393
As mentioned [above](#how-to-use), only subset of functionality is implemented now, but all contributions are welcome. Feel free to open [issues](https://github.com/knowledgepicker/word-cloud/issues) and [pull requests](https://github.com/knowledgepicker/word-cloud/pulls).
9494

95-
### Creating NuGet package
95+
### Release process
9696

97-
Until we have a CI pipeline, this is how we release new version of the package (don't forget to replace 1.0.0 with the correct version):
98-
99-
```bash
100-
cd src/KnowledgePicker.WordCloud
101-
dotnet pack -c Release --include-symbols --include-source -p:PackageVersion=1.0.0
102-
```
97+
After pushing a tag, GitHub workflow `release.yml` is triggered which builds and publishes the NuGet package.

eng/release.ps1

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Set-StrictMode -version 2.0
2+
$ErrorActionPreference = "Stop"
3+
4+
Write-Output "Working directory: $pwd"
5+
6+
# Load current Git tag.
7+
$tag = $(git describe --tags)
8+
Write-Output "Tag: $tag"
9+
10+
# Parse tag into a three-number version.
11+
$version = $tag.Split('-')[0].TrimStart('v')
12+
Write-Output "Version: $version"
13+
14+
Push-Location src/KnowledgePicker.WordCloud
15+
try {
16+
# Pack the library.
17+
dotnet pack -c Release --include-symbols --include-source `
18+
-p:PackageVersion=$version
19+
20+
# Push the NuGet package.
21+
dotnet nuget push `
22+
"bin/Release/KnowledgePicker.WordCloud.$version.symbols.nupkg" `
23+
--source https://api.nuget.org/v3/index.json `
24+
--api-key $env:NUGET_API_KEY
25+
} finally {
26+
Pop-Location
27+
}

0 commit comments

Comments
 (0)