From 989694c908831b635b78560985ff3afeb3b74974 Mon Sep 17 00:00:00 2001 From: Antonello Provenzano Date: Fri, 29 Mar 2024 20:03:26 +0100 Subject: [PATCH 1/2] Updates to the CI/CD scripts --- .github/workflows/cd.yml | 2 +- .github/workflows/manual-release.yml | 14 +++++++------ .github/workflows/pr.yml | 27 ++++++++++++++----------- .github/workflows/release.yml | 30 +++++++++++++++++----------- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c3252c5..acd326a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -52,7 +52,7 @@ jobs: run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_TFM }} /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*" - name: Collect to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.OCM_CODECOV_TOKEN }} diff --git a/.github/workflows/manual-release.yml b/.github/workflows/manual-release.yml index c938c08..46f5868 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: @@ -19,13 +23,8 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: | - 6.0.x - 7.0.x + dotnet-version: '8.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 - - name: Restore dependencies run: dotnet restore @@ -44,4 +43,7 @@ jobs: 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://nu/v3/index.json + + - name: Push Packages to 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/pr.yml b/.github/workflows/pr.yml index 15d5412..c234a70 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: true matrix: - dotnet: [ '6.0.x', '7.0.x' ] + dotnet: [ '6.0.x', '7.0.x', '8.0.x' ] os: [ ubuntu-latest, windows-latest ] runs-on: ${{ matrix.os }} @@ -27,17 +27,20 @@ jobs: with: dotnet-version: ${{ matrix.dotnet }} - - name: Set the TFM for .NET 6.0 - if: matrix.dotnet == '6.0.x' - run: echo "DOTNET_TFM=net6.0" >> $GITHUB_ENV - - - name: Set the TFM for .NET 7.0 - if: matrix.dotnet == '7.0.x' - run: echo "DOTNET_TFM=net7.0" >> $GITHUB_ENV - - - name: Set the TFM for .NET 8.0 - if: matrix.dotnet == '8.0.x' - run: echo "DOTNET_TFM=net8.0" >> $GITHUB_ENV + - name: Set the TFM in Ubuntu + if: startsWith(matrix.os, 'ubuntu') + 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9738693..18b1197 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: true matrix: - dotnet: [ '6.0.x', '7.0.x' ] + dotnet: [ '6.0.x', '7.0.x', '8.x.0' ] steps: - uses: actions/checkout@v4 @@ -30,17 +30,20 @@ jobs: with: dotnet-version: ${{ matrix.dotnet }} - - name: Set the TFM for .NET 6.0 - if: matrix.dotnet == '6.0.x' - run: echo "DOTNET_TFM=net6.0" >> $GITHUB_ENV - - - name: Set the TFM for .NET 7.0 - if: matrix.dotnet == '7.0.x' - run: echo "DOTNET_TFM=net7.0" >> $GITHUB_ENV + - name: Set the TFM in Ubuntu + if: startsWith(matrix.os, 'ubuntu') + 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 for .NET 8.0 - if: matrix.dotnet == '8.0.x' - run: echo "DOTNET_TFM=net8.0" >> $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 @@ -52,7 +55,7 @@ jobs: run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_TFM }} /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*" - name: Collect to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.OCM_CODECOV_TOKEN }} @@ -68,4 +71,7 @@ jobs: run: dotnet pack --configuration Release --include-symbols -p:PackageVersion=$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 NuGet run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json From a3048ac20af5a219adb2a9e3a1c78566cafd3318 Mon Sep 17 00:00:00 2001 From: Antonello Provenzano Date: Fri, 29 Mar 2024 20:14:59 +0100 Subject: [PATCH 2/2] Updates to the sample apps to .NET 8.0 --- samples/WebhookNotifierApp/WebhookNotifierApp.csproj | 2 +- .../WebhookReceiverApp.MinimalApi.csproj | 2 +- samples/WebhookReceiverApp/WebhookReceiverApp.csproj | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/WebhookNotifierApp/WebhookNotifierApp.csproj b/samples/WebhookNotifierApp/WebhookNotifierApp.csproj index 0c039df..105e06d 100644 --- a/samples/WebhookNotifierApp/WebhookNotifierApp.csproj +++ b/samples/WebhookNotifierApp/WebhookNotifierApp.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 enable enable Deveel.Webhooks diff --git a/samples/WebhookReceiverApp.MinimalApi/WebhookReceiverApp.MinimalApi.csproj b/samples/WebhookReceiverApp.MinimalApi/WebhookReceiverApp.MinimalApi.csproj index 537abb0..dfb55c9 100644 --- a/samples/WebhookReceiverApp.MinimalApi/WebhookReceiverApp.MinimalApi.csproj +++ b/samples/WebhookReceiverApp.MinimalApi/WebhookReceiverApp.MinimalApi.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net6.0;net7.0;net8.0 enable enable Deveel.Webhooks diff --git a/samples/WebhookReceiverApp/WebhookReceiverApp.csproj b/samples/WebhookReceiverApp/WebhookReceiverApp.csproj index e8f3e28..b24468e 100644 --- a/samples/WebhookReceiverApp/WebhookReceiverApp.csproj +++ b/samples/WebhookReceiverApp/WebhookReceiverApp.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net6.0;net7.0;net8.0 enable enable Deveel.Webhooks