mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-27 06:15:15 +00:00
75 lines
2.6 KiB
YAML
75 lines
2.6 KiB
YAML
name: Publish Tools
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- release/tools-2.x
|
|
paths:
|
|
- "packages/tools/package.json"
|
|
- ".github/workflows/publish-tools.yml"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
permissions:
|
|
contents: read
|
|
id-token: write
|
|
defaults:
|
|
run:
|
|
working-directory: ./packages/tools
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '24'
|
|
registry-url: 'https://registry.npmjs.org'
|
|
|
|
- name: Upgrade npm for trusted publishing support
|
|
run: npm install -g npm@latest
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
|
|
- name: Install dependencies
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Check if version changed
|
|
id: version-check
|
|
run: |
|
|
PACKAGE_NAME=$(jq -r '.name' package.json)
|
|
LOCAL_VERSION=$(jq -r '.version' package.json)
|
|
case "$LOCAL_VERSION" in
|
|
2.*) ;;
|
|
*) echo "::error::release/tools-2.x only publishes 2.x, found $LOCAL_VERSION"; exit 1 ;;
|
|
esac
|
|
if PUBLISHED=$(npm view "$PACKAGE_NAME@$LOCAL_VERSION" version 2>"$RUNNER_TEMP/npm-view.err") && [ -n "$PUBLISHED" ]; then
|
|
echo "Version $LOCAL_VERSION already published, skipping."
|
|
echo "changed=false" >> "$GITHUB_OUTPUT"
|
|
elif [ -z "$PUBLISHED" ] && { [ ! -s "$RUNNER_TEMP/npm-view.err" ] || grep -q E404 "$RUNNER_TEMP/npm-view.err"; }; then
|
|
echo "Publishing $LOCAL_VERSION under the legacy-2 dist-tag"
|
|
echo "changed=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
cat "$RUNNER_TEMP/npm-view.err"
|
|
echo "::error::Could not check whether $LOCAL_VERSION is already on npm"
|
|
exit 1
|
|
fi
|
|
|
|
- name: Build
|
|
if: steps.version-check.outputs.changed == 'true'
|
|
run: bun run build
|
|
|
|
- name: Unit tests
|
|
if: steps.version-check.outputs.changed == 'true'
|
|
run: bun run test:unit
|
|
|
|
- name: Publish
|
|
if: steps.version-check.outputs.changed == 'true'
|
|
run: npm publish --access public --provenance --tag legacy-2
|