-
Notifications
You must be signed in to change notification settings - Fork 4
129 lines (105 loc) · 3.31 KB
/
cd.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: CD
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
buildCSharp:
name: Build release CSharp
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Generate files and update Assembly Version
shell: bash
run: |
cd ./.generator/SchemaGenerator
dotnet run --genCsModel --genCsInterface --updateVersion
MSG=$(dotnet run --updateVersion | grep "New version")
VERSION=$(echo $MSG | awk -F': ' '{print $2}')
echo "ReleaseVersion $VERSION"
echo "ReleaseVersion=$VERSION" >> $GITHUB_ENV
- name: Create key pair for signing the assembly
if: github.ref == 'refs/heads/master'
working-directory: src/DragonflySchema
run: |
"C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\sn.exe" -k LadybugTools.snk
ls
shell: cmd
- name: Build
run: |
dotnet restore
dotnet build --configuration Release /nowarn:CS0472,CS0108
- name: Run Unit Tests
working-directory: src/DragonflySchema.Tests
run: dotnet test --configuration Release
- name: Release CSharp
working-directory: src/DragonflySchema
run: dotnet pack --configuration Release --output ./../../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nugetPackage
path: ./*.nupkg
outputs:
tag: ${{ env.ReleaseVersion }}
buildTypeScript:
name: Build release TypeScript
runs-on: ubuntu-latest
env:
CI: ""
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: generate files
run: |
cd ./.generator/SchemaGenerator
dotnet run --genTsModel --updateVersion
- name: Install dependencies
working-directory: src/TypeScriptSDK
run: npm i
- name: Build module
working-directory: src/TypeScriptSDK
run: npm run build
- name: Pack package
working-directory: src/TypeScriptSDK
run: |
npm pack
cp ./*.tgz ./../../
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: npmPackage
path: ./*.tgz
release:
name: both CSharp and TypeScript SDK
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
needs: [buildCSharp, buildTypeScript]
steps:
- uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
- name: Download artifact - nuget
uses: actions/download-artifact@v4
with:
name: nugetPackage
- name: Download artifact - npm
uses: actions/download-artifact@v4
with:
name: npmPackage
- name: Release CSharp
run: dotnet nuget push ./*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
- name: Publish to npm
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish ./*.tgz --access public