From 3662bfa5fa73c55b92f24b5a5ee0fee5aea7effc Mon Sep 17 00:00:00 2001 From: eiei114 <60887155+eiei114@users.noreply.github.com> Date: Fri, 29 May 2026 00:34:42 +0900 Subject: [PATCH 1/2] ci: publish from publish workflow --- .github/workflows/auto-release.yml | 77 ------------------------------ .github/workflows/publish.yml | 16 +++++-- 2 files changed, 12 insertions(+), 81 deletions(-) diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml index b753bf7..18b8a88 100644 --- a/.github/workflows/auto-release.yml +++ b/.github/workflows/auto-release.yml @@ -11,9 +11,6 @@ jobs: release: name: Create release for new version runs-on: ubuntu-latest - outputs: - released: ${{ steps.check.outputs.released }} - tag: ${{ steps.check.outputs.tag }} steps: - name: Checkout uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 @@ -48,77 +45,3 @@ jobs: gh release create "$TAG" --title "$TAG" --notes "$NOTES" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - publish: - name: Publish package - runs-on: ubuntu-latest - needs: release - if: needs.release.outputs.released == 'true' - concurrency: - group: npm-publish-${{ needs.release.outputs.tag }} - cancel-in-progress: false - permissions: - contents: read - id-token: write - steps: - - name: Checkout - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 - with: - ref: ${{ needs.release.outputs.tag }} - persist-credentials: false - - - name: Setup Node.js - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 - with: - node-version: 24 - registry-url: https://registry.npmjs.org - package-manager-cache: false - - - name: Install dependencies - shell: bash - run: | - if [ -f package-lock.json ]; then - npm ci - elif node -e "const p=require('./package.json'); process.exit(p.dependencies || p.devDependencies ? 0 : 1)"; then - npm install - else - echo "No dependencies to install." - fi - - - name: Validate package - shell: bash - run: | - if node -e "process.exit(require('./package.json').scripts?.check ? 0 : 1)"; then - npm run check - elif node -e "process.exit(require('./package.json').scripts?.test ? 0 : 1)"; then - npm test - elif node -e "process.exit(require('./package.json').scripts?.typecheck ? 0 : 1)"; then - npm run typecheck - else - echo "No validation script configured." - fi - - - name: Skip already published version - id: published - shell: bash - run: | - name=$(node -p "require('./package.json').name") - version=$(node -p "require('./package.json').version") - set +e - output=$(npm view "${name}@${version}" version 2>&1) - status=$? - set -e - if [ "$status" -eq 0 ]; then - echo "${name}@${version} is already published." - echo "skip=true" >> "$GITHUB_OUTPUT" - elif printf '%s' "$output" | grep -Eq 'E404|404 Not Found'; then - echo "Publishing ${name}@${version}." - echo "skip=false" >> "$GITHUB_OUTPUT" - else - printf '%s\n' "$output" >&2 - exit "$status" - fi - - - name: Publish to npm - if: steps.published.outputs.skip != 'true' - run: npm publish --access public diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 65f8842..931ed8a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,12 +28,13 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 with: ref: ${{ github.event.inputs.ref || github.ref }} + persist-credentials: false - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e with: node-version: 24 registry-url: https://registry.npmjs.org @@ -69,12 +70,19 @@ jobs: run: | name=$(node -p "require('./package.json').name") version=$(node -p "require('./package.json').version") - if npm view "${name}@${version}" version >/dev/null 2>&1; then + set +e + output=$(npm view "${name}@${version}" version 2>&1) + status=$? + set -e + if [ "$status" -eq 0 ]; then echo "${name}@${version} is already published." echo "skip=true" >> "$GITHUB_OUTPUT" - else + elif printf '%s' "$output" | grep -Eq 'E404|404 Not Found'; then echo "Publishing ${name}@${version}." echo "skip=false" >> "$GITHUB_OUTPUT" + else + printf '%s\n' "$output" >&2 + exit "$status" fi - name: Publish to npm From 583f68aafa545f881b2fcb71828aaa25a92e53f2 Mon Sep 17 00:00:00 2001 From: eiei114 <60887155+eiei114@users.noreply.github.com> Date: Fri, 29 May 2026 00:36:04 +0900 Subject: [PATCH 2/2] chore: bump package version to 0.2.2 --- README.md | 2 +- package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 126a5cc..f545e2f 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ pi install -l npm:pi-weighted-model-router To pin a specific version: ```bash -pi install npm:pi-weighted-model-router@0.2.1 +pi install npm:pi-weighted-model-router@0.2.2 ``` From a local checkout: diff --git a/package-lock.json b/package-lock.json index 3c8209e..27694d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pi-weighted-model-router", - "version": "0.2.1", + "version": "0.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pi-weighted-model-router", - "version": "0.2.1", + "version": "0.2.2", "license": "MIT", "devDependencies": { "@earendil-works/pi-ai": "^0.75.5", diff --git a/package.json b/package.json index dcfd7a8..50b1441 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pi-weighted-model-router", - "version": "0.2.1", + "version": "0.2.2", "description": "Pi extension that balances model/provider usage across weighted model pools.", "type": "module", "license": "MIT",