Publish TypeScript Client #47
This file contains 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: Publish TypeScript Client | |
on: | |
workflow_dispatch: | |
inputs: | |
release_message: | |
type: string | |
description: Release message | |
required: true | |
prerelease: | |
type: boolean | |
description: Is this a pre-release version? | |
required: false | |
default: false | |
permissions: | |
contents: write | |
jobs: | |
publish-langchain: | |
name: Publish Langchain Retriever to npm | |
runs-on: ubuntu-latest | |
needs: | |
- publish-client | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- run: cd packages/langchain && npm ci | |
- name: Build | |
run: cd packages/langchain && npm run build | |
- uses: JS-DevTools/npm-publish@v3 | |
with: | |
package: packages/langchain | |
token: ${{ secrets.NPM_TOKEN }} | |
publish-client: | |
name: Publish TypeScript Client to npm | |
runs-on: ubuntu-latest | |
needs: | |
- create-release | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: "20" | |
- run: npm ci | |
- name: Build | |
run: npm run build | |
- uses: JS-DevTools/npm-publish@v3 | |
with: | |
package: ./ | |
token: ${{ secrets.NPM_TOKEN }} | |
create-release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
needs: | |
- extract-version | |
steps: | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: "v${{ needs.extract-version.outputs.version }}" | |
prerelease: ${{ github.event.inputs.prerelease }} | |
body: ${{ github.event.inputs.release_message }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
extract-version: | |
name: Extract Version Number | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version_extraction.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: version_extraction | |
run: echo "version=$(cat package.json | jq .version | xargs)" >> "$GITHUB_OUTPUT" | |