From a76531ec405bc70fa3ff55fc9ac38e4c22f45e0c Mon Sep 17 00:00:00 2001 From: DDAndyChen Date: Fri, 8 Dec 2023 18:37:07 +1300 Subject: [PATCH] Improve workflow files #6 --- .github/workflows/publish Optional package.yml | 8 ++++++-- .../publish Optional.FluentValidation package.yml | 11 ++++++++--- .../publish Optional.NewtonsoftJson package.yml | 11 ++++++++--- src/Optional/Optional.csproj | 2 +- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish Optional package.yml b/.github/workflows/publish Optional package.yml index 6dc998d..1a381a0 100644 --- a/.github/workflows/publish Optional package.yml +++ b/.github/workflows/publish Optional package.yml @@ -5,6 +5,10 @@ on: tags: - 'Optional-*' + +env: + Project: src/Optional + jobs: build: runs-on: ubuntu-latest @@ -22,8 +26,8 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build "src/Optional" --configuration Release --no-restore + run: dotnet build ${{ env.Project }} --configuration Release --no-restore - name: Test run: dotnet test "tests/Optional.Tests/Optional.Tests.csproj" --configuration Release --no-restore --verbosity normal - name: Publish to GPR - run: dotnet nuget push "src/Optional/bin/Release/*.symbols.nupkg" + run: dotnet nuget push "${{ env.Project }}/bin/Release/*.snupkg" diff --git a/.github/workflows/publish Optional.FluentValidation package.yml b/.github/workflows/publish Optional.FluentValidation package.yml index e43ecd3..16809a7 100644 --- a/.github/workflows/publish Optional.FluentValidation package.yml +++ b/.github/workflows/publish Optional.FluentValidation package.yml @@ -5,6 +5,9 @@ on: tags: - 'Optional.FluentValidation-*' +env: + Project: src/Optional.FluentValidation + jobs: build: runs-on: ubuntu-latest @@ -22,8 +25,10 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build "src/Optional.FluentValidation" --configuration Release --no-restore + run: dotnet build ${{ env.Project }} --configuration Release --no-restore - name: Test - run: dotnet test "tests/Optional.FluentValidation.Tests/Optional.FluentValidation.Tests.csproj" --configuration Release --no-restore --verbosity normal + run: | + dotnet test "tests/Optional.Tests/Optional.Tests.csproj" --configuration Release --no-restore --verbosity normal + dotnet test "tests/Optional.FluentValidation.Tests/Optional.FluentValidation.Tests.csproj" --configuration Release --no-restore --verbosity normal - name: Publish to GPR - run: dotnet nuget push "src/Optional.FluentValidation/bin/Release/*.symbols.nupkg" + run: dotnet nuget push "${{ env.Project }}/bin/Release/*.snupkg" diff --git a/.github/workflows/publish Optional.NewtonsoftJson package.yml b/.github/workflows/publish Optional.NewtonsoftJson package.yml index ee59b2c..46a96cb 100644 --- a/.github/workflows/publish Optional.NewtonsoftJson package.yml +++ b/.github/workflows/publish Optional.NewtonsoftJson package.yml @@ -5,6 +5,9 @@ on: tags: - 'Optional.NewtonsoftJson-*' +env: + Project: src/Optional.NewtonsoftJson + jobs: build: runs-on: ubuntu-latest @@ -22,8 +25,10 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build "src/Optional.NewtonsoftJson" --configuration Release --no-restore + run: dotnet build ${{ env.Project }} --configuration Release --no-restore - name: Test - run: dotnet test "tests/Optional.NewtonsoftJson.Tests/Optional.NewtonsoftJson.Tests.csproj" --configuration Release --no-restore --verbosity normal + run: | + dotnet test "tests/Optional.Tests/Optional.Tests.csproj" --configuration Release --no-restore --verbosity normal + dotnet test "tests/Optional.NewtonsoftJson.Tests/Optional.NewtonsoftJson.Tests.csproj" --configuration Release --no-restore --verbosity normal - name: Publish to GPR - run: dotnet nuget push "src/Optional.NewtonsoftJson/bin/Release/*.symbols.nupkg" + run: dotnet nuget push "${{ env.Project }}/bin/Release/*.snupkg" diff --git a/src/Optional/Optional.csproj b/src/Optional/Optional.csproj index cbd0ae5..39c8484 100644 --- a/src/Optional/Optional.csproj +++ b/src/Optional/Optional.csproj @@ -3,7 +3,7 @@ latest net8.0 - 1.4.7 + 1.4.8 enable DeskDirector.Text.Json DeskDirector.$(AssemblyName)