@@ -3,14 +3,16 @@ name: CD
3
3
on :
4
4
push :
5
5
branches : [master]
6
+ pull_request :
7
+ branches : [master]
6
8
7
9
jobs :
8
- build :
10
+ buildCSharp :
11
+ name : Build release CSharp
9
12
runs-on : windows-latest
10
13
11
14
steps :
12
- - name : " Checkout Master Branch"
13
- uses : actions/checkout@v4
15
+ - uses : actions/checkout@v4
14
16
15
17
- name : Update Assembly Version
16
18
shell : bash
23
25
echo "ReleaseVersion=$VERSION" >> $GITHUB_ENV
24
26
25
27
- name : Create key pair for signing the assembly
28
+ if : github.ref == 'refs/heads/master'
26
29
working-directory : src/DragonflySchema
27
30
run : |
28
31
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -k LadybugTools.snk
@@ -36,11 +39,87 @@ jobs:
36
39
37
40
- name : Run Unit Tests
38
41
working-directory : src/DragonflySchema.Tests
39
- run : |
40
- dotnet test --configuration Release
42
+ run : dotnet test --configuration Release
41
43
42
- - name : Deploy
44
+ - name : Release CSharp
43
45
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
44
87
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
0 commit comments