mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-06-23 15:39:32 +00:00
94 lines
2.6 KiB
YAML
94 lines
2.6 KiB
YAML
name: Publish `@librechat/client` to NPM
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'packages/client/package.json'
|
|
workflow_dispatch:
|
|
inputs:
|
|
reason:
|
|
description: 'Reason for manual trigger'
|
|
required: false
|
|
default: 'Manual publish requested'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
pack:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
skip: ${{ steps.check.outputs.skip }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24.16.0'
|
|
|
|
- name: Install client dependencies
|
|
run: cd packages/client && npm ci
|
|
|
|
- name: Build client
|
|
run: cd packages/client && npm run build
|
|
|
|
- name: Check version change
|
|
id: check
|
|
working-directory: packages/client
|
|
run: |
|
|
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
|
PUBLISHED_VERSION=$(npm view @librechat/client version 2>/dev/null || echo "0.0.0")
|
|
if [ "$PACKAGE_VERSION" = "$PUBLISHED_VERSION" ]; then
|
|
echo "No version change, skipping publish"
|
|
echo "skip=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "Version changed, proceeding with publish"
|
|
echo "skip=false" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Pack package
|
|
if: steps.check.outputs.skip != 'true'
|
|
working-directory: packages/client
|
|
run: |
|
|
mkdir -p "$GITHUB_WORKSPACE/npm-package"
|
|
npm pack --pack-destination "$GITHUB_WORKSPACE/npm-package"
|
|
|
|
- name: Upload package
|
|
if: steps.check.outputs.skip != 'true'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: librechat-client-package
|
|
path: npm-package/*.tgz
|
|
if-no-files-found: error
|
|
retention-days: 2
|
|
|
|
publish-npm:
|
|
needs: pack
|
|
if: github.ref == 'refs/heads/main' && needs.pack.outputs.skip != 'true'
|
|
runs-on: ubuntu-latest
|
|
environment: publish # Must match npm trusted publisher config
|
|
permissions:
|
|
contents: read
|
|
id-token: write # Required for OIDC trusted publishing
|
|
steps:
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24.16.0'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Install npm with OIDC support
|
|
run: npm install -g npm@11.14.1 --ignore-scripts
|
|
|
|
- name: Download package
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: librechat-client-package
|
|
path: npm-package
|
|
|
|
- name: Publish
|
|
working-directory: npm-package
|
|
run: npm publish *.tgz --access public --provenance
|