From ba91906aa1cf74b61b0736af2d57d7b0907cb41c Mon Sep 17 00:00:00 2001 From: Antonello Provenzano Date: Wed, 4 Sep 2024 20:13:39 +0200 Subject: [PATCH] Manual release pipeline fix --- .github/workflows/manual-release.yml | 31 ++++++++++++++++++++-------- .github/workflows/release.yml | 17 ++------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml index c938c08..0057ded 100644 --- a/.github/workflows/manual-release.yml +++ b/.github/workflows/manual-release.yml @@ -1,5 +1,9 @@ name: "Webhooks Release (Manual)" +permissions: + contents: read + packages: write + on: workflow_dispatch: inputs: @@ -12,28 +16,34 @@ jobs: build: name: "Build and Test" runs-on: ubuntu-latest + strategy: + fail-fast: true + matrix: + dotnet: [ '6.0.x', '7.0.x', '8.0.x' ] steps: - uses: actions/checkout@v3 + - name: Set the TFM + run: | + VERSION=$(echo "${{ matrix.dotnet }}" | sed 's/[^0-9.]*//g') + VERSION=$(echo "${VERSION}" | sed 's/\.$//') + DOTNET_TFM="net${VERSION}" + echo "DOTNET_TFM=$DOTNET_TFM" >> $GITHUB_ENV + - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: | - 6.0.x - 7.0.x - - - name: Add Deveel GitHub NuGet Source - run: dotnet nuget add source "https://nuget.pkg.github.com/deveel/index.json" -n "Deveel GitHub" -u ${{ secrets.DEVEEL_NUGET_USER }} -p ${{ secrets.DEVEEL_NUGET_TOKEN }} --store-password-in-clear-text - + dotnet-version: ${{ matrix.dotnet }} + - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build --no-restore -c Release /p:Version=${{ inputs.version }} + run: dotnet build --no-restore -c Release /p:Version=${{ inputs.version }} -f ${{ env.DOTNET_TFM }} - name: Test - run: dotnet test --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*" + run: dotnet test --no-build --verbosity normal -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*" -f ${{ env.DOTNET_TFM }} - name: Collect to Codecov uses: codecov/codecov-action@v3 @@ -43,5 +53,8 @@ jobs: - name: Pack run: dotnet pack --configuration Release --no-restore --no-build --include-symbols -p:PackageVersion=${{ inputs.version }} --output ./nuget + - name: Push Packages to GitHub NuGet + run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/deveel/index.json" + - name: Push Packages to GitHub NuGet run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b841840..493cd51 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,20 +30,12 @@ jobs: with: dotnet-version: ${{ matrix.dotnet }} - - name: Set the TFM in Ubuntu - if: startsWith(matrix.os, 'ubuntu') + - name: Set the TFM run: | VERSION=$(echo "${{ matrix.dotnet }}" | sed 's/[^0-9.]*//g') VERSION=$(echo "${VERSION}" | sed 's/\.$//') DOTNET_TFM="net${VERSION}" echo "DOTNET_TFM=$DOTNET_TFM" >> $GITHUB_ENV - - - name: Set the TFM in Windows - if: startsWith(matrix.os, 'windows') - run: | - $VERSION = "${{ matrix.dotnet }}".Substring(0, "${{ matrix.dotnet }}".LastIndexOf('.')) - $DOTNET_TFM = "net$VERSION" - echo "DOTNET_TFM=$DOTNET_TFM" | Out-File -FilePath $env:GITHUB_ENV -Append - name: Restore dependencies run: dotnet restore @@ -51,13 +43,8 @@ jobs: - name: Build run: dotnet build --no-restore -c Release /p:Version=$VERSION -f ${{ env.DOTNET_TFM }} - - name: Test (Ubuntu) - if: startsWith(matrix.os, 'ubuntu-latest') + - name: Test run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_TFM }} /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*" - - - name: Test (Windows) - if: startsWith(matrix.os, 'windows') - run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_TFM }} --filter DB!=SQLServer - name: Collect to Codecov uses: codecov/codecov-action@v3