|
| 1 | +--- |
| 2 | +name: publish |
| 3 | +description: "Read changes since last release, create a changeset, push, merge the Version Packages PR, and publish all packages to npm via CI. Triggers on: publish, release, deploy packages, new version, patch release." |
| 4 | +--- |
| 5 | + |
| 6 | +# Publish Packages |
| 7 | + |
| 8 | +Automate the full release cycle: read changes, create changeset, push, merge Version Packages PR, and confirm npm publish. |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +## Step 1: Read Changes Since Last Release |
| 13 | + |
| 14 | +Find the last Version Packages commit and show what changed: |
| 15 | + |
| 16 | +```bash |
| 17 | +# Find the last "Version Packages" commit |
| 18 | +LAST_RELEASE=$(git log --oneline --all --grep="Version Packages" -1 --format="%H") |
| 19 | +git log --oneline "$LAST_RELEASE..HEAD" |
| 20 | +``` |
| 21 | + |
| 22 | +If there are no new commits since the last release, tell the user there's nothing to publish and stop. |
| 23 | + |
| 24 | +Show the user the list of commits and a brief summary of what changed. |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## Step 2: Create Changeset |
| 29 | + |
| 30 | +Determine which packages need to be included. The publishable packages are: |
| 31 | + |
| 32 | +- `@playfast/echoform` |
| 33 | +- `@playfast/echoform-render` |
| 34 | +- `@playfast/echoform-bun-ws-client` |
| 35 | +- `@playfast/echoform-bun-ws-server` |
| 36 | +- `@playfast/echoform-socket-client` |
| 37 | +- `@playfast/echoform-socket-server` |
| 38 | +- `@playfast/wmux` |
| 39 | +- `@playfast/wmux-client-terminal` |
| 40 | + |
| 41 | +Check if any new publishable packages have been added to `packages/` or `plugins/` that aren't in this list. If so, also add them to `scripts/resolve-workspace-deps.js`. |
| 42 | + |
| 43 | +Write a changeset file at `.changeset/<descriptive-name>.md`: |
| 44 | + |
| 45 | +```markdown |
| 46 | +--- |
| 47 | +"@playfast/echoform": patch |
| 48 | +"@playfast/echoform-render": patch |
| 49 | +"@playfast/echoform-bun-ws-client": patch |
| 50 | +"@playfast/echoform-bun-ws-server": patch |
| 51 | +"@playfast/echoform-socket-client": patch |
| 52 | +"@playfast/echoform-socket-server": patch |
| 53 | +"@playfast/wmux": patch |
| 54 | +"@playfast/wmux-client-terminal": patch |
| 55 | +--- |
| 56 | + |
| 57 | +<One-line summary of changes> |
| 58 | +``` |
| 59 | + |
| 60 | +Default to `patch` bump. If the user says "minor" or "major", use that instead. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## Step 3: Commit and Push |
| 65 | + |
| 66 | +```bash |
| 67 | +git add .changeset/ scripts/resolve-workspace-deps.js |
| 68 | +git commit -m "Add changeset for patch release |
| 69 | +
|
| 70 | +Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>" |
| 71 | +git push origin master |
| 72 | +``` |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Step 4: Wait for Version Packages PR |
| 77 | + |
| 78 | +The Release workflow (`release.yml`) runs on push to master. When changesets exist, it creates a "Version Packages" PR. |
| 79 | + |
| 80 | +```bash |
| 81 | +# Wait for the release workflow to finish |
| 82 | +gh run list --workflow=release.yml --limit 1 |
| 83 | +gh run watch <RUN_ID> --exit-status |
| 84 | +``` |
| 85 | + |
| 86 | +--- |
| 87 | + |
| 88 | +## Step 5: Merge Version Packages PR |
| 89 | + |
| 90 | +```bash |
| 91 | +gh pr list --head changeset-release/master --json number -q '.[0].number' |
| 92 | +gh pr merge <PR_NUMBER> --squash |
| 93 | +``` |
| 94 | + |
| 95 | +--- |
| 96 | + |
| 97 | +## Step 6: Wait for Publish and Confirm |
| 98 | + |
| 99 | +Merging triggers the release workflow again. This time (no changesets present) it publishes to npm. |
| 100 | + |
| 101 | +```bash |
| 102 | +# Watch the publish workflow |
| 103 | +gh run list --workflow=release.yml --limit 1 |
| 104 | +gh run watch <RUN_ID> --exit-status |
| 105 | + |
| 106 | +# Confirm what was published |
| 107 | +gh run view <RUN_ID> --log 2>/dev/null | grep -E '(being published|success packages)' | head -15 |
| 108 | +``` |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +## Step 7: Pull and Report |
| 113 | + |
| 114 | +```bash |
| 115 | +git pull origin master |
| 116 | +``` |
| 117 | + |
| 118 | +Show the user a table of all published packages with their new versions. |
| 119 | + |
| 120 | +--- |
| 121 | + |
| 122 | +## Important Notes |
| 123 | + |
| 124 | +- Always use `--squash` when merging the Version Packages PR. |
| 125 | +- If the release workflow fails, check the logs with `gh run view <ID> --log` and report the error. |
| 126 | +- Do NOT attempt to publish locally with `npm publish` — always go through the CI workflow. |
| 127 | +- If `resolve-workspace-deps.js` needs updating for new packages, commit that change along with the changeset. |
0 commit comments