Skip to content

Add OpenAI traceable wrapper for JS (#451) #29

Add OpenAI traceable wrapper for JS (#451)

Add OpenAI traceable wrapper for JS (#451) #29

Workflow file for this run

name: JS Release
on:
push:
branches:
- main
paths:
- "js/package.json"
workflow_dispatch:
jobs:
if_release:
# Disallow publishing from branches that aren't `main`.
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v3
# JS Build
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
cache-dependency-path: "js/yarn.lock"
- name: Install dependencies
run: cd js && yarn install --immutable
- name: Build
run: cd js && yarn run build
- name: Check version
run: cd js && yarn run check-version
- name: Check NPM version
id: check_npm_version
run: |
cd js
if yarn run check-npm-version; then
echo "::set-output name=should_publish::true"
else
echo "::set-output name=should_publish::false"
fi
- name: Publish package to NPM
if: steps.check_npm_version.outputs.should_publish == 'true'
run: |
cd js
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
yarn publish --non-interactive