From 48796c4c004c2be44d369f0b041f8d9e1f1e73ab Mon Sep 17 00:00:00 2001 From: cmendible <266546+cmendible@users.noreply.github.com> Date: Fri, 29 Mar 2024 10:06:43 +0100 Subject: [PATCH] pushing nuget package --- .github/workflows/netDumbster.yml | 43 ++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 4 deletions(-) diff --git a/.github/workflows/netDumbster.yml b/.github/workflows/netDumbster.yml index 44e631a..d6c7e9e 100644 --- a/.github/workflows/netDumbster.yml +++ b/.github/workflows/netDumbster.yml @@ -1,7 +1,17 @@ name: dotnetcore on: + workflow_dispatch: push: + branches: + - main + tags: + - v* pull_request: + branches: + - main + +permissions: read-all + jobs: build: name: Build @@ -10,16 +20,41 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: - - name: Check out code - uses: actions/checkout@v1 + - name: Check out code into the Go module directory + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Get all history to allow automatic versioning using MinVer - name: Setup .NET Core uses: actions/setup-dotnet@v1 with: dotnet-version: 8.0.x + + - name: Setup MinVer + run: | + dotnet tool install --global minver-cli --version 4.2.0 + + - name: Calculate Version + run: | + echo "MINVERVERSIONOVERRIDE=$($HOME/.dotnet/tools/minver -t v. -m 0.1 -d preview)" >> $GITHUB_ENV + if: matrix.os != 'windows-latest' + + - name: Calculate Version Windows + run: | + echo "MINVERVERSIONOVERRIDE=$(minver -t v. -m 0.1 -d preview)" >> $env:GITHUB_ENV + if: matrix.os == 'windows-latest' - name: Build - run: dotnet build + run: dotnet build -c Release - name: Test - run: dotnet test + run: dotnet test -c Release --no-build + + - name: Pack nugets + run: dotnet pack -c Release --no-build --output . + if: matrix.os == 'linux-latest' && github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/v') + + - name: Push to NuGet + run: dotnet nuget push "*.nupkg" --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json + if: matrix.os == 'linux-latest' && github.event_name != 'pull_request' && startswith(github.ref, 'refs/tags/v') +