Skip to content

Major cleanup and refactoring across instructor and polyglot #379

Major cleanup and refactoring across instructor and polyglot

Major cleanup and refactoring across instructor and polyglot #379

Workflow file for this run

name: Split packages
on:
push:
branches: ['main']
tags: ['v*']
permissions:
contents: write
#env:
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
jobs:
split:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
# Generated from packages.json - DO NOT EDIT MANUALLY
- local: 'packages/addons'
repo: 'cognesy/instructor-addons'
name: 'instructor-addons'
- local: 'packages/agents'
repo: 'cognesy/agents'
name: 'agents'
- local: 'packages/agent-ctrl'
repo: 'cognesy/instructor-agent-ctrl'
name: 'instructor-agent-ctrl'
- local: 'packages/auxiliary'
repo: 'cognesy/instructor-aux'
name: 'instructor-aux'
- local: 'packages/config'
repo: 'cognesy/instructor-config'
name: 'instructor-config'
- local: 'packages/doctor'
repo: 'cognesy/instructor-doctor'
name: 'instructor-doctor'
- local: 'packages/dynamic'
repo: 'cognesy/instructor-dynamic'
name: 'instructor-dynamic'
- local: 'packages/evals'
repo: 'cognesy/instructor-evals'
name: 'instructor-evals'
- local: 'packages/events'
repo: 'cognesy/instructor-events'
name: 'instructor-events'
- local: 'packages/http-client'
repo: 'cognesy/instructor-http-client'
name: 'instructor-http-client'
- local: 'packages/hub'
repo: 'cognesy/instructor-hub'
name: 'instructor-hub'
- local: 'packages/instructor'
repo: 'cognesy/instructor-struct'
name: 'instructor-struct'
- local: 'packages/laravel'
repo: 'cognesy/instructor-laravel'
name: 'instructor-laravel'
- local: 'packages/logging'
repo: 'cognesy/instructor-logging'
name: 'instructor-logging'
- local: 'packages/messages'
repo: 'cognesy/instructor-messages'
name: 'instructor-messages'
- local: 'packages/metrics'
repo: 'cognesy/instructor-metrics'
name: 'instructor-metrics'
- local: 'packages/pipeline'
repo: 'cognesy/instructor-pipeline'
name: 'instructor-pipeline'
- local: 'packages/polyglot'
repo: 'cognesy/instructor-polyglot'
name: 'instructor-polyglot'
- local: 'packages/sandbox'
repo: 'cognesy/instructor-sandbox'
name: 'instructor-sandbox'
- local: 'packages/schema'
repo: 'cognesy/instructor-schema'
name: 'instructor-schema'
- local: 'packages/setup'
repo: 'cognesy/instructor-setup'
name: 'instructor-setup'
- local: 'packages/stream'
repo: 'cognesy/instructor-stream'
name: 'instructor-stream'
- local: 'packages/tell'
repo: 'cognesy/instructor-tell'
name: 'instructor-tell'
- local: 'packages/templates'
repo: 'cognesy/instructor-templates'
name: 'instructor-templates'
- local: 'packages/utils'
repo: 'cognesy/instructor-utils'
name: 'instructor-utils'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for proper splitting
# Use centralized release notes from docs/release-notes
- name: Prepare release notes
if: github.ref_type == 'tag'
id: prepare_notes
run: |
TAG_NAME=${{ github.ref_name }}
# Release notes are centralized in docs/release-notes/
CENTRAL_NOTES="docs/release-notes/${TAG_NAME}.mdx"
if [ -f "$CENTRAL_NOTES" ]; then
echo "NOTES_PATH=$CENTRAL_NOTES" >> $GITHUB_ENV
echo "Using centralized release notes from $CENTRAL_NOTES"
else
echo "Warning: No release notes found at $CENTRAL_NOTES"
echo "NOTES_PATH=" >> $GITHUB_ENV
fi
# ► push branch + tag
- name: Split Monorepo
uses: "danharrin/monorepo-split-github-action@v2.3.0"
env:
GITHUB_TOKEN: ${{ secrets.SPLIT_TOKEN_4 }}
with:
#github_token: ${{ secrets.SPLIT_TOKEN_4 }} # PAT here
tag: ${{ github.ref_type == 'tag' && github.ref_name || '' }}
branch: ${{ github.ref_type == 'branch' && github.ref_name || '' }}
package_directory: ${{ matrix.package.local }}
repository_organization: cognesy
repository_name: ${{ matrix.package.name }}
user_name: 'ddebowczyk'
user_email: 'ddebowczyk@gmail.com'
# ► create GitHub Release with notes
- uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag' && env.NOTES_PATH != ''
env:
GITHUB_TOKEN: ${{ secrets.SPLIT_TOKEN_4 }}
with:
repository: ${{ matrix.package.repo }} # target repo
tag_name: ${{ github.ref_name }} # v1.2.3
body_path: ${{ env.NOTES_PATH }}
token: ${{ secrets.SPLIT_TOKEN_4 }} # PAT here
wait-for-packagist:
needs: split
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
steps:
- name: Wait for Packagist
run: |
# Wait 1 minute(s) for Packagist to update
sleep 60
echo "Waited for Packagist to update"
tests:
needs: wait-for-packagist
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: ['8.2', '8.3', '8.4']
composer: ['--prefer-stable']
steps:
- name: Install dependencies in all packages
run: |
for dir in packages/*; do
if [ -f "$dir/composer.json" ]; then
echo "📦 Installing dependencies in $dir"
composer --working-dir="$dir" update --no-interaction ${{ matrix.composer }}
fi
done
- name: Run tests in all packages
run: |
for dir in packages/*; do
if [ -f "$dir/composer.json" ]; then
echo "🔍 Running tests in $dir"
composer --working-dir="$dir" test
fi
done