diff --git a/.github/workflows/dotnetcore-release.yml b/.github/workflows/dotnetcore-release.yml new file mode 100644 index 00000000..681bc15d --- /dev/null +++ b/.github/workflows/dotnetcore-release.yml @@ -0,0 +1,68 @@ +name: Build and Publish NuGet Package + +on: + push: + tags: + - 'v*.*.*' + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup .NET Core + uses: actions/setup-dotnet@v2 + with: + dotnet-version: '8.0.x' + + - name: Restore dependencies + run: dotnet restore + + - name: Sign and Build Project + env: + SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + run: | + pwsh -File ./deployment/build-signed.ps1 -csprojFilePath './src/RulesEngine/RulesEngine.csproj' -signingKey $SIGNING_KEY + + - name: Create NuGet package + run: | + # Extract version from the tag + VERSION=$(echo ${{ github.ref }} | sed 's/refs\/tags\/v//') + # Create the NuGet package with the version from the tag + dotnet pack --configuration Release --no-build --output ./nuget_packages /p:PackageVersion=$VERSION + + - name: Publish NuGet package to NuGet.org + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: dotnet nuget push ./nuget_packages/*.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json + + - name: Create source code zip + run: | + git archive -o source.zip HEAD + continue-on-error: true + + - name: Create source code tar + run: | + git archive -o source.tar.gz HEAD + continue-on-error: true + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: source-archives + path: | + source.zip + source.tar.gz + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: | + ./nuget_packages/*.nupkg + source.zip + source.tar.gz + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj b/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj index 45c7a272..92c37e77 100644 --- a/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj +++ b/benchmark/RulesEngineBenchmark/RulesEngineBenchmark.csproj @@ -3,6 +3,7 @@ Exe net8.0 + false diff --git a/demo/DemoApp/DemoApp.csproj b/demo/DemoApp/DemoApp.csproj index b570a1cb..912416d8 100644 --- a/demo/DemoApp/DemoApp.csproj +++ b/demo/DemoApp/DemoApp.csproj @@ -4,6 +4,7 @@ Exe net8.0 DemoApp.Program + false diff --git a/deployment/build-signed.ps1 b/deployment/build-signed.ps1 index b6c57b43..84460d2f 100644 --- a/deployment/build-signed.ps1 +++ b/deployment/build-signed.ps1 @@ -8,6 +8,7 @@ param( # sign and build the project $directory = Split-Path $csprojFilePath; $signKeyFile = Join-Path $directory "signKey.snk"; +$signKeyFile = [System.IO.Path]::GetFullPath($signKeyFile) $bytes = [Convert]::FromBase64String($signingKey) [IO.File]::WriteAllBytes($signKeyFile, $bytes) diff --git a/signing/RulesEngine-publicKey.snk b/signing/RulesEngine-publicKey.snk index 10341c93..8bc1fb0f 100644 Binary files a/signing/RulesEngine-publicKey.snk and b/signing/RulesEngine-publicKey.snk differ diff --git a/src/RulesEngine/Properties/AssemblyInfo.cs b/src/RulesEngine/Properties/AssemblyInfo.cs index 1bda1490..eb3a4c3a 100644 --- a/src/RulesEngine/Properties/AssemblyInfo.cs +++ b/src/RulesEngine/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] -[assembly: InternalsVisibleTo("RulesEngine.UnitTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c15956b2ac0945c55b69a185f5c3e02276693b0a5e42c8a1f08cb24e03dd87d91f9fa09f79b6b7b3aac4df46f2ea4ce4bfa31920bb0aad9f02793ab29de9fbf40f5ba9e347aa8569128459f31da1f6357eabe6e1308ac7c16b87a4d61e8d1785746a57ec67956d2e2454b3c98502a5d5c4a4168133bfaa431207c108efae03aa")] +[assembly: InternalsVisibleTo("RulesEngine.UnitTest, PublicKey=0024000004800000940000000602000000240000525341310004000001000100112dc71470f95d4d3cbd1c61a2ed2fbc0480d332aa06932c4ac9450b321b94237bd05e592686b78cec721a1d77c4030f9fd357cefbed3296bcb4f91f6724de444684eab5fd59d85faac37fdb8f0d336d975cfbeb8bc309a59dc208822493c19ad5ce0c7c904a32ca45170b50d6b43040b59ca21d4c0d93b7d0b520b82ac313d8")] diff --git a/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj b/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj index ce4be85f..20623c9b 100644 --- a/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj +++ b/test/RulesEngine.UnitTest/RulesEngine.UnitTest.csproj @@ -4,6 +4,7 @@ True ..\..\signing\RulesEngine-publicKey.snk True + false