Skip to content

Add package.json step #10

Add package.json step

Add package.json step #10

Workflow file for this run

name: Compile TypeScript Protobuf Definitions
on: [push]
jobs:
compile:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
cd protobuf_definitions
npm init -y
npm install -D ts-proto
- name: Compile
run: |
cd protobuf_definitions
mkdir -p ./out/ &&
protoc *.proto --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_out=./out --ts_proto_opt=outputIndex=true
- name: Create package
run: |
cd protobuf_definitions/out
SHORT_SHA=${GITHUB_SHA::8}
echo '{
"name": "@blueye-robotocs/protocol-definitions",
"version": "0.0.0-'${SHORT_SHA}'",
"main": "index.js",
"types": "index.d.ts",
"files": ["."],
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
}
}' > package.json
- name: Publish compiled proto definitions
uses: actions/upload-artifact@v4
with:
path: protobuf_definitions/out