Skip to content

Commit 5a474b5

Browse files
committed
chore(ci): Adds release branch support for nuget publish.
1 parent 0fe590b commit 5a474b5

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/nuget-publish.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
push:
55
tags:
66
- '[0-9]+.[0-9]+.[0-9]+'
7+
branches:
8+
- 'release/[0-9]+.[0-9]+.[0-9]+'
79

810
jobs:
911
publish:
@@ -19,23 +21,32 @@ jobs:
1921
with:
2022
dotnet-version: '10.x'
2123

24+
- name: Determine version
25+
id: version
26+
run: |
27+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
28+
echo "version=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
29+
elif [[ "${GITHUB_REF}" == refs/heads/release/* ]]; then
30+
SEMVER="${GITHUB_REF_NAME#release/}"
31+
RC_NUMBER="${GITHUB_RUN_NUMBER}"
32+
echo "version=${SEMVER}-rc.${RC_NUMBER}" >> "$GITHUB_OUTPUT"
33+
fi
34+
2235
- name: Restore dependencies
2336
run: dotnet restore
2437

2538
- name: Build with explicit version
2639
run: |
27-
VERSION=${GITHUB_REF_NAME}
2840
dotnet build \
2941
--configuration Release \
30-
-p:Version=$VERSION \
42+
-p:Version=${{ steps.version.outputs.version }} \
3143
--no-restore
3244
3345
- name: Pack with symbols
3446
run: |
35-
VERSION=${GITHUB_REF_NAME}
3647
dotnet pack \
3748
--configuration Release \
38-
-p:Version=$VERSION \
49+
-p:Version=${{ steps.version.outputs.version }} \
3950
-p:IncludeSymbols=true \
4051
-p:SymbolPackageFormat=snupkg \
4152
--no-build \

0 commit comments

Comments
 (0)