Skip to content

Commit 0085178

Browse files
committed
Create tsconfig & compile
1 parent 34d5a34 commit 0085178

File tree

1 file changed

+43
-17
lines changed

1 file changed

+43
-17
lines changed

.github/workflows/ci-typescript.yaml

Lines changed: 43 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,62 @@ jobs:
1515
with:
1616
node-version: "latest"
1717

18+
- name: Create tsconfig
19+
run: |
20+
cd protobuf_definitions
21+
echo '{
22+
"compilerOptions": {
23+
"target": "ES2020",
24+
"module": "CommonJS",
25+
"declaration": true,
26+
"outDir": "dist",
27+
"strict": true,
28+
"esModuleInterop": true
29+
},
30+
"include": ["./**/*.ts"]
31+
}' > tsconfig.json
32+
33+
- name: Create package
34+
run: |
35+
cd protobuf_definitions
36+
SHORT_SHA=${GITHUB_SHA::8}
37+
echo '{
38+
"name": "@blueye-robotics/protocol-definitions",
39+
"version": "0.0.0-'${SHORT_SHA}'",
40+
"main": "out/dist/index.js",
41+
"types": "out/dist/index.d.ts",
42+
"files": ["out/dist"],
43+
"publishConfig": {
44+
"registry": "https://npm.pkg.github.com/"
45+
},
46+
"scripts": {
47+
"build": "tsc"
48+
},
49+
"devDependencies": {
50+
"ts-proto": "^2.7.5",
51+
"typescript": "^5.8.3"
52+
},
53+
}' > package.json
54+
1855
- name: Install dependencies
1956
run: |
2057
sudo apt-get update
2158
sudo apt-get install -y protobuf-compiler
2259
cd protobuf_definitions
23-
npm init -y
24-
npm install -D ts-proto
60+
npm install
2561
26-
- name: Compile
62+
- name: Generate
2763
run: |
2864
cd protobuf_definitions
2965
mkdir -p ./out/ &&
3066
protoc *.proto --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./out --ts_proto_opt=outputIndex=true
3167
32-
- name: Create package
68+
- name: Compile
3369
run: |
34-
cd protobuf_definitions/out
35-
SHORT_SHA=${GITHUB_SHA::8}
36-
echo '{
37-
"name": "@blueye-robotocs/protocol-definitions",
38-
"version": "0.0.0-'${SHORT_SHA}'",
39-
"main": "index.js",
40-
"types": "index.d.ts",
41-
"files": ["."],
42-
"publishConfig": {
43-
"registry": "https://npm.pkg.github.com/"
44-
}
45-
}' > package.json
70+
cd protobuf_definitions
71+
npm run build
4672
4773
- name: Publish compiled proto definitions
4874
uses: actions/upload-artifact@v4
4975
with:
50-
path: protobuf_definitions/out
76+
path: protobuf_definitions

0 commit comments

Comments
 (0)