Skip to content

fix: regenerate OpenAPI spec from gateway schema fixes #15

fix: regenerate OpenAPI spec from gateway schema fixes

fix: regenerate OpenAPI spec from gateway schema fixes #15

Workflow file for this run

name: TypeScript Client CI
on:
push:
branches: [main]
paths:
- 'clients/typescript/**'
- 'spec/**'
- '.github/workflows/typescript-ci.yml'
pull_request:
branches: [main]
paths:
- 'clients/typescript/**'
- 'spec/**'
- '.github/workflows/typescript-ci.yml'
jobs:
build-and-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: clients/typescript
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Generate types from spec
run: npm run generate
- name: Build
run: npm run build
- name: Test
run: npm test
- name: Lint
run: npm run lint
- name: Typecheck
run: npm run typecheck
publish:
needs: build-and-test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: clients/typescript
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Generate types from spec
run: npm run generate
- name: Build
run: npm run build
- name: Check if version already published
id: version-check
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
if npm view "@selfpatch/ros2-medkit-client-ts@${PKG_VERSION}" version 2>/dev/null; then
echo "Version ${PKG_VERSION} already published, skipping"
echo "skip=true" >> "$GITHUB_OUTPUT"
else
echo "Publishing version ${PKG_VERSION}"
echo "skip=false" >> "$GITHUB_OUTPUT"
fi
- name: Publish to npmjs
if: steps.version-check.outputs.skip != 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}