Simple Files Vector Store Server
by lishenxydlgzs
Verified
- simple-files-vectorstore
- .github
- workflows
name: Tests and Publish
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run test
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-report-node-${{ matrix.node-version }}
path: coverage/
publish:
needs: test
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Check version
id: check
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "Package version: $PACKAGE_VERSION"
# Check if the version exists in npm registry
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/@lishenxydlgzs/simple-files-vectorstore/$PACKAGE_VERSION")
if [ "$HTTP_STATUS" = "200" ]; then
echo "Version $PACKAGE_VERSION already published, skipping..."
echo "should_publish=false" >> $GITHUB_OUTPUT
else
echo "Publishing new version $PACKAGE_VERSION..."
echo "should_publish=true" >> $GITHUB_OUTPUT
fi
- name: Build and publish
if: steps.check.outputs.should_publish == 'true'
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}