Fix publishing? #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
registry-url: https://npm.pkg.github.com/ | |
scope: "@blueye-robotics" | |
- name: Create tsconfig | |
run: | | |
cd protobuf_definitions | |
echo '{ | |
"compilerOptions": { | |
"target": "ES2020", | |
"module": "CommonJS", | |
"declaration": true, | |
"outDir": "dist", | |
"strict": true, | |
"esModuleInterop": true | |
}, | |
"include": ["./**/*.ts"] | |
}' > tsconfig.json | |
- name: Create package | |
run: | | |
cd protobuf_definitions | |
SHORT_SHA=${GITHUB_SHA::8} | |
echo '{ | |
"name": "@blueye-robotics/protocol-definitions", | |
"version": "0.0.0-test.'${SHORT_SHA}'", | |
"main": "out/dist/index.js", | |
"types": "out/dist/index.d.ts", | |
"files": ["out/dist"], | |
"publishConfig": { | |
"registry": "https://npm.pkg.github.com/" | |
}, | |
"scripts": { | |
"build": "tsc" | |
}, | |
"devDependencies": { | |
"ts-proto": "^2.7.5", | |
"typescript": "^5.8.3" | |
} | |
}' > package.json | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y protobuf-compiler | |
cd protobuf_definitions | |
npm install | |
- name: Generate | |
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 --ts_proto_opt=globalThisPolyfill=true | |
- name: Compile | |
run: | | |
cd protobuf_definitions | |
npm run build | |
- name: Publish to GitHub Packages | |
run: | | |
cd protobuf_definitions | |
npm publish --tag test | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish compiled proto definitions | |
uses: actions/upload-artifact@v4 | |
with: | |
path: protobuf_definitions |