Skip to content

Commit

Permalink
Create Nethereum metapackage (#4)
Browse files Browse the repository at this point in the history
* GitHubCI: add metapackage push

Following:
https://danielwertheim.se/how-to-create-a-nuget-metapackage/

Co-authored-by: Mehrshad <[email protected]>

* GithubCI: use nugetPreRelease.fsx to get version

* GithubCI: publish package on nuget

* GithubCI: add conditions for "Push" step

Check for presence of secrets.NUGET_API_KEY is made in script
itself, because Github actions don't have access to secrets
context in if statements (see [1]).

[1] https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
  • Loading branch information
webwarrior-ws authored Apr 2, 2024
1 parent 23f50de commit fc1b47d
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 6 additions & 0 deletions nugetPreRelease.fsx
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit fc1b47d

Please sign in to comment.