Upload

To upload your schema to our hosted dashboard, first create an account at https://drift.trpc.io then follow the onboarding to create your first project.

Create an API key for your project and add it to your repository secrets as DRIFT_API_KEY (or any name you want, just modify the below example accordingly).

Next, create a new actions workflow in your repository (only Github supported for now) with the following content (may vary depending on monorepo structure, package manager etc.)

name: Upload Example Schema to Drift
 
on:
  pull_request:
    branches: ["*"]
    types: [opened, synchronize, reopened, edited, closed] # <--- **IMPORTANT** to subscribe to these events
  push:
    branches: ["main"]
 
jobs:
  test:
    runs-on: ubuntu-latest
 
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 5 # <--- **IMPORTANT**, has to be >= 3. Give us some history to work with
 
      - uses: pnpm/action-setup@v2.2.4
 
      - uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: pnpm
 
      - name: Install dependencies
        run: pnpm install
 
      - name: Upload schema
        run: pnpm trpc upload -vv # `-vv` optional for extra logs
        env:
          API_KEY: ${{ secrets.DRIFT_API_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Upload Example Schema to Drift
 
on:
  pull_request:
    branches: ["*"]
    types: [opened, synchronize, reopened, edited, closed] # <--- **IMPORTANT** to subscribe to these events
  push:
    branches: ["main"]
 
jobs:
  test:
    runs-on: ubuntu-latest
 
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 5 # <--- **IMPORTANT**, has to be >= 3. Give us some history to work with
 
      - uses: pnpm/action-setup@v2.2.4
 
      - uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: pnpm
 
      - name: Install dependencies
        run: pnpm install
 
      - name: Upload schema
        run: pnpm trpc upload -vv # `-vv` optional for extra logs
        env:
          API_KEY: ${{ secrets.DRIFT_API_KEY }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}