-
Notifications
You must be signed in to change notification settings - Fork 4
155 lines (128 loc) · 4.04 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: CD
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
genNewVersion:
name: Check and get a new version for release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get Version
run: |
cd ./.generator/SchemaGenerator
MSG=$(dotnet run --updateVersion | grep "New version")
VERSION=$(echo $MSG | awk -F': ' '{print $2}')
echo "ReleaseVersion $VERSION"
echo "ReleaseVersion=$VERSION" >> $GITHUB_ENV
outputs:
ReleaseVersion: ${{ env.ReleaseVersion }}
buildCSharp:
name: Build release CSharp
runs-on: windows-latest
needs: [genNewVersion]
env:
RELEASE_VERSION: ${{ needs.genNewVersion.outputs.ReleaseVersion }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Generate files
shell: bash
run: |
cd ./.generator/SchemaGenerator
dotnet run --genCsModel --genCsInterface --updateVersion
- 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
- 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
buildTypeScript:
name: Build TypeScript
runs-on: ubuntu-latest
needs: [genNewVersion]
env:
CI: ""
RELEASE_VERSION: ${{ needs.genNewVersion.outputs.ReleaseVersion }}
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 and bundle module
# working-directory: src/TypescriptSDK
# run: |
# npm run build
# npm run bundle:dts
- name: Build and pack package
working-directory: src/TypescriptSDK
run: |
npm pack
cp ./*.tgz ./../../
- name: Unit tests
working-directory: src/TypescriptSDK.Tests
run: |
npm i ./../TypescriptSDK/dragonfly-schema-${{env.RELEASE_VERSION}}.tgz
npm i honeybee-schema
npm run test
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: npmPackage
path: ./*.tgz
release:
name: Release 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