diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index bbfb70062..b803ca828 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -22,3 +22,57 @@ jobs: run: | cd src & ".\nugetDevBuild.bat" + + push: + needs: build + runs-on: ubuntu-22.04 + env: + BASE_VERSION: 4.20.0 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup .NET + uses: actions/setup-dotnet@v3 + with: + dotnet-version: 8.0.x + + - name: Add dependencies + run: | + dotnet new classlib --name Nethereum --framework netstandard2.0 + cd Nethereum + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.ABI + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.Accounts + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.Contracts + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.Hex + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.KeyStore + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.RLP + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.RPC + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.Signer + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.StandardTokenEIP20 + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.Util + dotnet add package --version ${{env.BASE_VERSION}} Nethereum.Web3 + rm Class1.cs + + - name: Pack + run: | + cd Nethereum + + VERSION="$(dotnet fsi ../nugetPreRelease.fsx $BASE_VERSION)" + + dotnet pack \ + --configuration Release \ + --output ../dist \ + --property:IncludeBuildOutput=false \ + --property:IncludeContentInPack=false \ + --property:TargetFrameworks=netstandard2.0 \ + --property:Version=$VERSION + + - name: Push + if: github.event_name == 'push' && github.ref == 'refs/heads/upstream' + run: | + cd dist + if [ -n "${{secrets.NUGET_API_KEY}}" ]; then + dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json + fi diff --git a/nugetPreRelease.fsx b/nugetPreRelease.fsx new file mode 100644 index 000000000..71cadf764 --- /dev/null +++ b/nugetPreRelease.fsx @@ -0,0 +1,6 @@ +#r "nuget: Fsdk, Version=0.6.0--date20231213-0703.git-d7a5962" + +let args = fsi.CommandLineArgs + +Fsdk.Network.GetNugetPrereleaseVersionFromBaseVersion args.[1] +|> System.Console.WriteLine