Skip to content

Commit 3cbfcbf

Browse files
committed
chore(CI): update workflow to build/release C# and Ts
1 parent 73d86a1 commit 3cbfcbf

File tree

3 files changed

+87
-74
lines changed

3 files changed

+87
-74
lines changed

.github/workflows/cd.yaml

Lines changed: 87 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@ name: CD
33
on:
44
push:
55
branches: [master]
6+
pull_request:
7+
branches: [master]
68

79
jobs:
8-
build:
10+
buildCSharp:
11+
name: Build release CSharp
912
runs-on: windows-latest
1013

1114
steps:
12-
- name: "Checkout Master Branch"
13-
uses: actions/checkout@v4
15+
- uses: actions/checkout@v4
1416

1517
- name: Update Assembly Version
1618
shell: bash
@@ -23,6 +25,7 @@ jobs:
2325
echo "ReleaseVersion=$VERSION" >> $GITHUB_ENV
2426
2527
- name: Create key pair for signing the assembly
28+
if: github.ref == 'refs/heads/master'
2629
working-directory: src/DragonflySchema
2730
run: |
2831
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -k LadybugTools.snk
@@ -36,11 +39,87 @@ jobs:
3639
3740
- name: Run Unit Tests
3841
working-directory: src/DragonflySchema.Tests
39-
run: |
40-
dotnet test --configuration Release
42+
run: dotnet test --configuration Release
4143

42-
- name: Deploy
44+
- name: Release CSharp
4345
working-directory: src/DragonflySchema
46+
run: dotnet pack --configuration Release --output ./../../
47+
48+
- name: Upload artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: nugetPackage
52+
path: ./*.nupkg
53+
54+
outputs:
55+
tag: ${{ env.ReleaseVersion }}
56+
57+
buildTypeScript:
58+
name: Build release TypeScript
59+
runs-on: ubuntu-latest
60+
env:
61+
CI: ""
62+
63+
steps:
64+
- uses: actions/checkout@v4
65+
66+
- name: Set up Node
67+
uses: actions/setup-node@v4
68+
with:
69+
node-version: "20"
70+
registry-url: "https://registry.npmjs.org"
71+
72+
- name: generate files
73+
run: |
74+
cd ./.nswag-generator
75+
dotnet run --genTsModel --updateVersion
76+
77+
- name: Install dependencies
78+
working-directory: src/TypeScriptSDK
79+
run: npm i
80+
81+
- name: Build module
82+
working-directory: src/TypeScriptSDK
83+
run: npm run build
84+
85+
- name: Pack package
86+
working-directory: src/TypeScriptSDK
4487
run: |
45-
dotnet pack --configuration Release
46-
dotnet nuget push bin\Release\DragonflySchema.*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
88+
npm pack
89+
cp ./*.tgz ./../../
90+
91+
- name: Upload artifact
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: npmPackage
95+
path: ./*.tgz
96+
97+
release:
98+
name: both CSharp and TypeScript SDK
99+
if: github.ref == 'refs/heads/master'
100+
runs-on: ubuntu-latest
101+
needs: [buildCSharp, buildTypeScript]
102+
103+
steps:
104+
- uses: actions/setup-node@v4
105+
with:
106+
node-version: "20"
107+
registry-url: "https://registry.npmjs.org"
108+
109+
- name: Download artifact - nuget
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: nugetPackage
113+
114+
- name: Download artifact - npm
115+
uses: actions/download-artifact@v4
116+
with:
117+
name: npmPackage
118+
119+
- name: Release CSharp
120+
run: dotnet nuget push ./*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
121+
122+
- name: Publish to npm
123+
env:
124+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
125+
run: npm publish ./*.tgz --access public

.github/workflows/npm_package.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.

.github/workflows/pull_request.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)