From 7cfdaaff4790483ca6464a59c0267a301942022f Mon Sep 17 00:00:00 2001 From: atakavci Date: Fri, 31 Jan 2025 10:40:28 +0300 Subject: [PATCH] auto set version in csproj --- .github/workflows/nuget-release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/nuget-release.yml b/.github/workflows/nuget-release.yml index 5a9b5d23..3a0c3e09 100644 --- a/.github/workflows/nuget-release.yml +++ b/.github/workflows/nuget-release.yml @@ -19,6 +19,25 @@ jobs: run: dotnet --list-sdks - name: Check .NET runtimes run: dotnet --list-runtimes + + - name: get version from tag + id: get_version + run: | + realversion="${GITHUB_REF/refs\/tags\//}" + realversion="${realversion//v/}" + echo "VERSION=$realversion" >> $GITHUB_OUTPUT + + - name: Update version in csproj + run: | + VERSION=${{ steps.get_version.outputs.VERSION }} + echo "Setting version to $VERSION" + + # Update the version in the NRedisStack.csproj file + sed -i "s|.*|$VERSION|" ./src/NRedisStack/NRedisStack.csproj + sed -i "s|.*|$VERSION|" ./src/NRedisStack/NRedisStack.csproj + sed -i "s|.*|$VERSION|" ./src/NRedisStack/NRedisStack.csproj + cat ./src/NRedisStack/NRedisStack.csproj + - name: Build run: dotnet pack -c Release --output . - name: Publish