Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: CI

on:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
BUN_VERSION: 1.3.14
NODE_VERSION: 24
RELEASE_VERSION: 0.0.0-ci.0

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: bun install --frozen-lockfile
- run: bun run check

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: bun install --frozen-lockfile
- run: bun run test

backends:
runs-on: ubuntu-latest
strategy:
matrix:
backend: [postgres, redis]
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- run: bun install --frozen-lockfile
- run: bun run test:backend:${{ matrix.backend }}

release-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ env.BUN_VERSION }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: https://registry.npmjs.org
- run: npm install --global npm@latest
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun run release:prepare --version "$RELEASE_VERSION"
- run: bun run release:validate --version "$RELEASE_VERSION"
- run: bun run release:publish --version "$RELEASE_VERSION" --tag ci --dry-run
32 changes: 32 additions & 0 deletions .github/workflows/publish-validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Validate Publish

on:
workflow_dispatch:
inputs:
version:
description: Release version to stage
required: true
type: string
default: 0.1.0-rc.1

permissions:
contents: read

jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
- run: npm install --global npm@latest
- run: bun install --frozen-lockfile
- run: bun run build
- run: bun run release:prepare --version "${{ inputs.version }}"
- run: bun run release:validate --version "${{ inputs.version }}"
- run: bun run release:publish --version "${{ inputs.version }}" --tag rc --dry-run
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Release

on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
version:
description: Existing release version to publish or resume
required: true
type: string
tag:
description: npm dist-tag
required: true
default: rc
type: string

permissions:
contents: write
id-token: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.14
- uses: actions/setup-node@v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
- run: npm install --global npm@latest
- name: Derive release version
id: release
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
bun run release:tag-info --version "$MANUAL_VERSION" --tag "$MANUAL_TAG"
else
bun run release:tag-info
fi
env:
MANUAL_VERSION: ${{ inputs.version }}
MANUAL_TAG: ${{ inputs.tag }}
- run: bun install --frozen-lockfile
- run: bun run check
- run: bun run test
- run: bun run build
- run: bun run release:prepare --version "${{ steps.release.outputs.version }}"
- run: bun run release:validate --version "${{ steps.release.outputs.version }}"
- run: bun run release:publish --version "${{ steps.release.outputs.version }}" --tag "${{ steps.release.outputs.tag }}"
- name: Create GitHub release
if: github.event_name == 'push'
run: gh release create "$GITHUB_REF_NAME" --generate-notes ${{ contains(steps.release.outputs.version, '-') && '--prerelease' || '' }}
env:
GH_TOKEN: ${{ github.token }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ out
# Nuxt.js build / generate output
.nuxt
dist
.release/
.output

# Gatsby files
Expand Down
27 changes: 22 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ flowchart LR

| Package | What it is |
| --------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| [`packages/delivery`](./packages/delivery/) | The core: `Channels.make`, mailboxes, delivery modes, handoff, the delivery API and its client. |
| [`packages/slack`](./packages/slack/) | `SlackBot.make`: Slack events, threads, messages, reactions, files, streaming, status line. |
| [`packages/github`](./packages/github/) | `GitHubBot.make`: GitHub App events, issues, pull requests, reviews, checks, and job logs. |
| [`packages/linear`](./packages/linear/) | `LinearBot.make`: Linear Agent Sessions, issues, comments, reactions, and files. |
| [`packages/delivery`](./packages/delivery/) | The core: `Channels.make`, mailboxes, delivery modes, handoff, the delivery API and its client. |
| [`packages/slack`](./packages/slack/) | `SlackBot.make`: Slack events, threads, messages, reactions, files, streaming, status line. |
| [`packages/github`](./packages/github/) | `GitHubBot.make`: GitHub App events, issues, pull requests, reviews, checks, and job logs. |
| [`packages/linear`](./packages/linear/) | `LinearBot.make`: Linear Agent Sessions, issues, comments, reactions, and files. |
| [`packages/sql`](./packages/sql/) | Mailbox storage on Postgres. |
| [`packages/redis`](./packages/redis/) | Mailbox storage on Redis. |
| [`packages/alchemy-cloudflare`](./packages/alchemy-cloudflare/) | Mailbox storage on Cloudflare Durable Objects, one object per mailbox, woken by its alarm. |
Expand Down Expand Up @@ -352,7 +352,7 @@ Nothing runs until one of these is built, and a program that uses more than one
| ---------- | --------------------------------------------------------------- | ------------------------- |
| Postgres | [`packages/sql`](./packages/sql/) | `ChannelsSql.make` |
| Redis | [`packages/redis`](./packages/redis/) | `ChannelsRedis.make` |
| Memory | [`packages/delivery`](./packages/delivery/) | `ChannelsMemory.make` |
| Memory | [`packages/delivery`](./packages/delivery/) | `ChannelsMemory.make` |
| Cloudflare | [`packages/alchemy-cloudflare`](./packages/alchemy-cloudflare/) | `ChannelsCloudflare.make` |

Every store supports handoff. Memory is for tests and local work: it forgets everything when the process stops.
Expand Down Expand Up @@ -564,3 +564,20 @@ bun run format
`bun run test` needs no database, no credentials, and no network.

Every store must pass one shared suite, [`packages/delivery/test/backend-contract.ts`](./packages/delivery/test/backend-contract.ts). The Postgres and Redis runs live in `packages/sql/test-backends` and `packages/redis/test-backends`, and are left out of `bun run test` because they need a real database.

## Releasing

Every package in `packages/` is published to npm together, at the same version.

- **Check a release without publishing.** Run the _Validate Publish_ workflow in GitHub Actions. It builds every package, installs the packed files into a fresh project, typechecks a sample app against them, loads them in Node.js, and runs `npm publish --dry-run`. Pull requests run the same check.
- **Publish.** Push a tag: `v0.2.0` publishes as `latest`; `v0.2.0-rc.1` publishes under the `rc` tag, which people only get by asking for it. GitHub signs in to npm through trusted publishing, so no npm token is stored anywhere.
- **Resume a failed release.** Run the _Release_ workflow by hand with the same version. Packages already on npm are skipped.

To run the same steps locally:

```sh
bun run build
bun run release:prepare --version 0.2.0-rc.1
bun run release:validate --version 0.2.0-rc.1
bun run release:publish --version 0.2.0-rc.1 --tag rc --dry-run
```
42 changes: 31 additions & 11 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading