Skip to content

Commit 76ad757

Browse files
authored
Merge pull request #28 from 0phois/AssemblyVersion
Update deploy-nuget-package.yml
2 parents 5893b91 + 73afd6c commit 76ad757

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/deploy-nuget-package.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,38 @@ jobs:
1818
runs-on: ubuntu-latest
1919
env:
2020
VERSION: 1.0.0
21+
ASSEMBLY_VERSION: 1.0.0.0
2122
outputs:
2223
VERSION: ${{ steps.output-version.outputs.VERSION }}
24+
ASSEMBLY_VERSION: ${{ steps.output-version.outputs.ASSEMBLY_VERSION }}
2325
steps:
2426
- name: Set tag from input
2527
if: ${{ github.event.inputs.version != '' }}
2628
env:
2729
TAG: ${{ github.event.inputs.version }}
28-
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
30+
run: |
31+
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
32+
# Extract main version and prerelease number
33+
MAIN_VERSION=$(echo "${TAG#v}" | cut -d'-' -f1)
34+
PRERELEASE_NUM=$(echo "${TAG#v}" | grep -oP '(?<=-.*\.)\d+$' || echo "0")
35+
echo "ASSEMBLY_VERSION=${MAIN_VERSION}.${PRERELEASE_NUM}" >> $GITHUB_ENV
2936
3037
- name: Set version variable from tag
3138
if: ${{ github.ref_type == 'tag' }}
3239
env:
3340
TAG: ${{ github.ref_name }}
34-
run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV
41+
run: |
42+
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
43+
# Extract main version and prerelease number
44+
MAIN_VERSION=$(echo "${TAG#v}" | cut -d'-' -f1)
45+
PRERELEASE_NUM=$(echo "${TAG#v}" | grep -oP '(?<=-.*\.)\d+$' || echo "0")
46+
echo "ASSEMBLY_VERSION=${MAIN_VERSION}.${PRERELEASE_NUM}" >> $GITHUB_ENV
3547
3648
- name: VERSION to job output
3749
id: output-version
3850
run: |
3951
echo "VERSION=${{ env.VERSION }}" >> $GITHUB_OUTPUT
52+
echo "ASSEMBLY_VERSION=${{ env.ASSEMBLY_VERSION }}" >> $GITHUB_OUTPUT
4053
4154
deploy-nuget:
4255
name: Deploy mudblazor.staticInput nuget to nuget.org
@@ -52,7 +65,7 @@ jobs:
5265
with:
5366
dotnet-version: 9.0.x
5467
- name: Pack nuget package
55-
run: dotnet pack -c Release --output nupkgs /p:PackageVersion=${{ needs.get-version.outputs.VERSION }} /p:AssemblyVersion=${{ needs.get-version.outputs.VERSION }} /p:Version=${{ needs.get-version.outputs.VERSION }}
68+
run: dotnet pack -c Release --output nupkgs /p:PackageVersion=${{ needs.get-version.outputs.VERSION }} /p:AssemblyVersion=${{ needs.get-version.outputs.ASSEMBLY_VERSION }} /p:Version=${{ needs.get-version.outputs.VERSION }}
5669
working-directory: ./src
5770
- name: Publish nuget package
5871
run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)