diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..c3ec190f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,98 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + - "v*.*.*-alpha.*" + - "v*.*.*-beta.*" + +permissions: + contents: read + id-token: write # Required for npm provenance + +env: + NODE_VERSION: "22.x" + +jobs: + verify-version: + name: Verify version + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Extract version from tag + id: tag + run: | + TAG=${GITHUB_REF#refs/tags/v} + echo "version=$TAG" >> $GITHUB_OUTPUT + echo "Tagged version: $TAG" + + - name: Read package.json version + id: package + run: | + VERSION=$(node -p "require('./package.json').version") + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Package version: $VERSION" + + - name: Compare versions + run: | + if [ "${{ steps.tag.outputs.version }}" != "${{ steps.package.outputs.version }}" ]; then + echo "ERROR: Tag version (${{ steps.tag.outputs.version }}) does not match package.json version (${{ steps.package.outputs.version }})" + exit 1 + fi + echo "Versions match: ${{ steps.tag.outputs.version }}" + + publish: + name: Publish to npm + runs-on: ubuntu-latest + needs: verify-version + environment: + name: npm + url: https://www.npmjs.com/package/@ampersend_ai/clawrouter-core + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + package_json_file: package.json + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ env.NODE_VERSION }} + registry-url: "https://registry.npmjs.org" + cache: "pnpm" + cache-dependency-path: pnpm-lock.yaml + + - name: Update npm + run: npm install -g npm@latest + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build package + run: pnpm build + + - name: Determine publish tag + id: publish-tag + run: | + VERSION="${GITHUB_REF#refs/tags/v}" + if [[ "$VERSION" == *"-alpha."* ]]; then + echo "tag=alpha" >> $GITHUB_OUTPUT + echo "Publishing with tag: alpha" + elif [[ "$VERSION" == *"-beta."* ]]; then + echo "tag=beta" >> $GITHUB_OUTPUT + echo "Publishing with tag: beta" + else + echo "tag=latest" >> $GITHUB_OUTPUT + echo "Publishing with tag: latest" + fi + + - name: Publish to npm + run: npm publish --access public --tag ${{ steps.publish-tag.outputs.tag }} diff --git a/package-lock.json b/package-lock.json index 32e79c60..75d4ce41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@blockrun/clawrouter", - "version": "0.10.4", + "version": "0.10.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@blockrun/clawrouter", - "version": "0.10.4", + "version": "0.10.6", "license": "MIT", "dependencies": { "viem": "^2.39.3" diff --git a/package.json b/package.json index 1253dc48..9231e694 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@blockrun/clawrouter", + "name": "@ampersend_ai/clawrouter-core", "version": "0.10.6", "description": "Smart LLM router — save 92% on inference costs. 41+ models, one wallet, x402 micropayments.", "type": "module", @@ -65,7 +65,7 @@ "license": "MIT", "repository": { "type": "git", - "url": "git+https://github.com/BlockRunAI/ClawRouter.git" + "url": "git+https://github.com/edgeandnode/ClawRouter.git" }, "dependencies": { "viem": "^2.39.3"