Skip to content

Commit

Permalink
Add release GitHub workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jjonescz committed Oct 1, 2022
1 parent f436265 commit 83c23e6
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 7 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Release

on:
push:
tags: [v*]

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Run release script
shell: pwsh
run: ./eng/release.ps1
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ This library is also used in production by [KnowledgePicker](https://knowledgepi

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).

### Creating NuGet package
### Release process

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):

```bash
cd src/KnowledgePicker.WordCloud
dotnet pack -c Release --include-symbols --include-source -p:PackageVersion=1.0.0
```
After pushing a tag, GitHub workflow `release.yml` is triggered which builds and publishes the NuGet package.
27 changes: 27 additions & 0 deletions eng/release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"

Write-Output "Working directory: $pwd"

# Load current Git tag.
$tag = $(git describe --tags)
Write-Output "Tag: $tag"

# Parse tag into a three-number version.
$version = $tag.Split('-')[0].TrimStart('v')
Write-Output "Version: $version"

Push-Location src/KnowledgePicker.WordCloud
try {
# Pack the library.
dotnet pack -c Release --include-symbols --include-source `
-p:PackageVersion=$version

# Push the NuGet package.
dotnet nuget push `
"bin/Release/KnowledgePicker.WordCloud.$version.symbols.nupkg" `
--source https://api.nuget.org/v3/index.json `
--api-key $env:NUGET_API_KEY
} finally {
Pop-Location
}

0 comments on commit 83c23e6

Please sign in to comment.