Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(dotnet): Added .NET codegen support #38

Merged
merged 14 commits into from
Feb 11, 2024
Merged
3 changes: 3 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ filename = "gen/node/package.json"

[[tool.bumpversion.files]]
filename = "gen/haskell/utxorpc.cabal"

[[tool.bumpversion.files]]
filename = "gen/dotnet/Utxorpc.V1.csproj"
33 changes: 33 additions & 0 deletions .github/actions/publish-dotnet/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'publish dotnet'
description: 'Generates nuget package and publishes to nuget.org'
inputs:
registry-token:
description: token to authenticate to nuget.org
required: false
mode:
description: supported values are 'release' and 'dry-run'
required: true

runs:
using: 'composite'
steps:

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x' # Specify your .NET version here

- name: Restore dependencies
working-directory: codegen/dotnet
run: dotnet restore

- name: Build
working-directory: codegen/dotnet
run: dotnet build --configuration Release --no-restore

- name: Pack
run: dotnet pack --configuration Release --no-build --output ./nupkgs

- name: Publish to NuGet
if: inputs.mode == 'release'
run: dotnet nuget push ./nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ inputs.registry-token }} --skip-duplicate
17 changes: 17 additions & 0 deletions .github/workflows/publish-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,20 @@ jobs:
with:
repository-token: ${{ secrets.HACKAGE_REGISTRY_TOKEN }}
mode: ${{ inputs.mode }}

publish-dotnet:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: codegen
path: ./codegen

- uses: ./.github/actions/publish-dotnet
with:
registry-token: ${{ secrets.NUGET_REGISTRY_TOKEN }}
mode: ${{ inputs.mode }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
.DS_Store
dist-newstyle
dist-newstyle
# .NET build files
bin
obj
9 changes: 8 additions & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ plugins:
path: proto-lens-protoc
out: gen/haskell

# dotnet
- plugin: buf.build/grpc/csharp:v1.60.0
out: gen/dotnet

- plugin: buf.build/protocolbuffers/csharp
out: gen/dotnet

# other

- plugin: buf.build/grpc-ecosystem/openapiv2
Expand All @@ -71,4 +78,4 @@ plugins:
- plugin: buf.build/community/pseudomuto-doc
out: gen/docs
opt:
- markdown,docs.md
- markdown,docs.md
Loading