Simple Files Vector Store Server

by lishenxydlgzs
Verified
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: | PUBLISHED_VERSION=$(npm view @lishenxydlgzs/simple-files-vectorstore version || echo "0.0.0") PACKAGE_VERSION=$(node -p "require('./package.json').version") if [ "$PUBLISHED_VERSION" = "$PACKAGE_VERSION" ]; 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 publish env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}