GitHub Actions

Deploy to RaidFrame from GitHub Actions CI/CD pipelines.

Quick Start

Add this workflow to .github/workflows/deploy.yml:

name: Deploy to RaidFrame
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy to RaidFrame
        uses: raidframe/deploy-action@v1
        with:
          token: ${{ secrets.RAIDFRAME_TOKEN }}
          project: my-saas
          environment: production

Configuration

Inputs

InputRequiredDefaultDescription
tokenYesRaidFrame API token
projectNoAuto-detectProject name
environmentNoproductionTarget environment
serviceNoAllSpecific service to deploy
waitNotrueWait for healthy deployment
timeoutNo300Deploy timeout in seconds
canaryNoCanary percentage (e.g., 10)

Outputs

OutputDescription
deployment_idDeployment ID
urlDeployment URL
versionDeployment version

Examples

Deploy on Push to Main

name: Deploy Production
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: raidframe/deploy-action@v1
        with:
          token: ${{ secrets.RAIDFRAME_TOKEN }}
          environment: production

Deploy Staging on PR

name: Deploy Preview
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: raidframe/deploy-action@v1
        id: deploy
        with:
          token: ${{ secrets.RAIDFRAME_TOKEN }}
          environment: preview

      - name: Comment PR with URL
        uses: actions/github-script@v7
        with:
          script: |
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: `Preview deployed: ${{ steps.deploy.outputs.url }}`
            })

Test → Deploy Pipeline

name: CI/CD
on:
  push:
    branches: [main]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npm test
      - run: npm run lint

  deploy:
    needs: test
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: raidframe/deploy-action@v1
        with:
          token: ${{ secrets.RAIDFRAME_TOKEN }}

Canary Deploy with Auto-Promote

name: Canary Deploy
on:
  push:
    branches: [main]

jobs:
  canary:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Deploy Canary (10%)
        uses: raidframe/deploy-action@v1
        with:
          token: ${{ secrets.RAIDFRAME_TOKEN }}
          canary: 10

      - name: Wait and Monitor
        run: sleep 600  # 10 minutes

      - name: Promote to 100%
        uses: raidframe/canary-action@v1
        with:
          token: ${{ secrets.RAIDFRAME_TOKEN }}
          action: promote
          percent: 100

Run Database Migrations

- name: Run Migrations
  uses: raidframe/exec-action@v1
  with:
    token: ${{ secrets.RAIDFRAME_TOKEN }}
    service: web
    command: "npx prisma migrate deploy"

Create an API Token

rf auth token create --name "GitHub Actions" --scope deploy,env:read --expires 365d

Add the token as a GitHub repository secret named RAIDFRAME_TOKEN.

Terraform Provider

For infrastructure-as-code workflows:

terraform init
terraform {
  required_providers {
    raidframe = {
      source  = "raidframe/raidframe"
      version = "~> 1.0"
    }
  }
}

provider "raidframe" {
  token = var.raidframe_token
}

resource "raidframe_project" "main" {
  name   = "my-saas"
  region = "us-east-1"
}

resource "raidframe_service" "web" {
  project = raidframe_project.main.id
  name    = "web"
  type    = "web"
  port    = 3000

  scaling {
    min = 2
    max = 20
  }

  resources {
    plan = "pro"
  }
}

resource "raidframe_database" "main" {
  project = raidframe_project.main.id
  name    = "main"
  engine  = "postgres"
  version = "16"
  plan    = "pro"
}