Skip to content

Commit

Permalink
Add ability to publish pre-release Nuget packages (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
cuongph87 authored Oct 25, 2024
1 parent bb56963 commit db5e9a9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/publish_nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,25 @@ jobs:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v4
- run: dotnet pack --configuration Release --output ${{env.NuGetDirectory}} -p:PackageVersion=${{github.event.release.tag_name}}
- name: Set version
id: set_version
shell: pwsh
run: |
echo "$version"
$version = "${{github.event.release.tag_name}}"
$isPrerelease = "${{github.event.release.prerelease}}" -eq "true"
$hasPrereleaseSuffix = $version -match "-\w+"
if ($isPrerelease -and -not $hasPrereleaseSuffix) {
Write-Error "Pre-release tag must contain a suffix (e.g., -alpha, -beta, -rc). Found: $version"
exit 1
}
if (-not $isPrerelease -and $hasPrereleaseSuffix) {
Write-Error "Regular release tag must not contain a pre-release suffix. Found: $version"
exit 1
}
echo "VERSION=$version" >> $env:GITHUB_ENV
- run: dotnet pack --configuration Release --output ${{env.NuGetDirectory}} -p:PackageVersion=${{env.VERSION}}
- uses: actions/upload-artifact@v3
with:
name: nuget
Expand Down

0 comments on commit db5e9a9

Please sign in to comment.