Skip to content

Commit 803a212

Browse files
committed
feat: added nuget package
1 parent 1d7c7e0 commit 803a212

File tree

6 files changed

+479
-2
lines changed

6 files changed

+479
-2
lines changed

.github/workflows/build_csharp.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build C# Package
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
buildJavaScript:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
12+
- uses: actions/download-artifact@v3
13+
with:
14+
name: json-schema
15+
path: packages/csharp
16+
17+
- uses: actions/setup-node@v3
18+
name: Setup Node
19+
20+
- name: Install Dependencies
21+
run: npm install quicktype --save
22+
23+
- name: Create Typescript
24+
run: npx quicktype --src packages/csharp/lcax.schema.json --lang csharp --out packages/csharp/lcax.cs --namespace LCAx --features just-types
25+
26+
- name: Upload C#
27+
uses: actions/upload-artifact@v3
28+
with:
29+
name: csharp-schema
30+
path: 'packages/lcax/lcax.cs'

.github/workflows/cicd.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ jobs:
3434
needs:
3535
- buildRust
3636

37+
buildCSharp:
38+
uses: ./.github/workflows/build_csharp.yaml
39+
needs:
40+
- buildRust
41+
3742
createRelease:
3843
if: github.event_name != 'pull_request'
3944
uses: ./.github/workflows/create_release.yaml
@@ -64,4 +69,14 @@ jobs:
6469
needs:
6570
- createRelease
6671
secrets:
67-
npm_token: ${{ secrets.NPM_TOKEN }}
72+
npm_token: ${{ secrets.NPM_TOKEN }}
73+
74+
publishCSharp:
75+
if: (github.event_name != 'pull_request') && ${{ needs.createRelease.output.version != '' }}
76+
uses: ./.github/workflows/publish_csharp.yaml
77+
needs:
78+
- createRelease
79+
with:
80+
version: ${{ needs.createRelease.output.version }}
81+
secrets:
82+
nuget_token: ${{ secrets.NUGET_TOKEN }}

.github/workflows/publish_csharp.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
name: Publish NuGet Package
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
version:
8+
type: string
9+
required: true
10+
secrets:
11+
nuget_token:
12+
required: true
13+
14+
jobs:
15+
publishJavaScript:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- uses: actions/download-artifact@v3
21+
with:
22+
name: csharp-schema
23+
path: packages/csharp/lcax
24+
25+
- name: Setup dotnet
26+
uses: actions/setup-dotnet@v3
27+
with:
28+
dotnet-version: '7.0.x'
29+
30+
- name: Install dependencies
31+
run: dotnet restore
32+
33+
- name: Bump Version
34+
run: sed -i "s/\(<Version>\)\([0-9]\.*\)\{3\}/\1${{ inputs.version }}/" packages/csharp/lcax/lcax.csproj
35+
36+
- name: Pack
37+
run: dotnet pack
38+
39+
- name: Publish Package
40+
run: |
41+
cd packages/csharp/lcax
42+
dotnet nuget push bin/Release/lcax.* --api-key ${{ secrets.nuget_token }} --source https://api.nuget.org/v3/index.json

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,4 +181,6 @@ packages/javascript
181181

182182
node_modules/
183183
package.json
184-
package-lock.json
184+
package-lock.json
185+
/packages/csharp/lcax/bin/
186+
/packages/csharp/lcax/obj/

0 commit comments

Comments
 (0)