test(pi-herdr-rename): await branch checks #164
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish packages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'packages/**' | |
| permissions: | |
| contents: read | |
| id-token: write | |
| concurrency: | |
| group: npm-publish | |
| cancel-in-progress: false | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| cache: npm | |
| - run: npm ci | |
| - run: npm test | |
| - run: npm run typecheck | |
| - run: npm run pack:check | |
| - name: Publish new package versions | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| shopt -s nullglob | |
| published=0 | |
| declare -A seen=() | |
| # Prerequisites must exist before their consumers release. | |
| for manifest in packages/pi-herdr/package.json packages/pi-multi-codex/package.json packages/pi-task-models/package.json packages/pi-subagent/package.json packages/*/package.json; do | |
| case "$manifest" in | |
| packages/pi-herdr/package.json|packages/pi-multi-codex/package.json|packages/pi-task-models/package.json|packages/pi-subagent/package.json) | |
| [ "${seen[$manifest]:-0}" = 1 ] && continue | |
| seen[$manifest]=1 | |
| ;; | |
| esac | |
| name="$(node -p "require('./$manifest').name")" | |
| if [ "$(node -p "Boolean(require('./$manifest').private)")" = true ]; then | |
| continue | |
| fi | |
| local_version="$(node -p "require('./$manifest').version")" | |
| remote_version="$(npm view "$name" version 2>/dev/null || true)" | |
| if [ "$local_version" = "$remote_version" ]; then | |
| continue | |
| fi | |
| echo "Publishing $name@$local_version" | |
| npm publish --workspace "$name" | |
| published=1 | |
| done | |
| if [ "$published" = 0 ]; then | |
| echo 'No new package versions.' | |
| fi |