From df9d38f21805bebc8ccef525757f269e770dd30d Mon Sep 17 00:00:00 2001 From: Marcin Badurowicz Date: Tue, 12 Nov 2024 23:11:44 +0100 Subject: [PATCH] Update GH Actions --- .github/workflows/ci.yml | 5 ++--- .github/workflows/tag.yml | 31 +++++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a91025..ebe8081 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI build +name: Build and Test on: push: @@ -8,8 +8,7 @@ on: jobs: build: - runs-on: ubuntu-latest - name: CI Build + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml index a3285f9..0390aae 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/tag.yml @@ -14,7 +14,7 @@ jobs: uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v4 with: dotnet-version: '9.0.x' @@ -25,7 +25,7 @@ jobs: run: dotnet build --configuration Release --no-restore - name: Test - run: dotnet test --no-build --verbosity normal + run: dotnet test --verbosity normal publish-nuget: needs: build-and-test @@ -34,16 +34,35 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 # avoid shallow clone so nbgv can do its work. - name: Setup .NET - uses: actions/setup-dotnet@v5 + uses: actions/setup-dotnet@v4 with: dotnet-version: '9.0.x' + # Use GitVersion + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v3.0.0 + with: + versionSpec: '6.x' + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v3.0.0 + - name: Publish NuGet Package - run: | - dotnet nuget add source --name "nuget.org" --source "https://api.nuget.org/v3/index.json" + run: | dotnet pack --configuration Release --no-build --output ./nupkg/ dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source "nuget.org" env: - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} \ No newline at end of file + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + + - name: Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.gitversion.outputs.semVer }} + name: v${{ steps.gitversion.outputs.semVer }} + files: | + ./nupkg/*.nupkg \ No newline at end of file