Skip to content

Update CI to use an action #22

Update CI to use an action

Update CI to use an action #22

Workflow file for this run

name: API Deployment
on:
push:
branches:
- 'main'
paths:
- 'apps/api/**'
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
COOKIE_SECRET: ${{ secrets.COOKIE_SECRET }}
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
APP_URL: ${{ secrets.APP_URL }}
CLOUDFLARE_TURNSTILE_SECRET_KEY: ${{ secrets.CLOUDFLARE_TURNSTILE_SECRET_KEY }}
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
jobs:
deploy-production:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- name: Install Dependencies
run: bun install
- run: bun run turbo db:migrate
env:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
- run: bun run build --filter=api
- uses: antfu/action-write-config
with:
path: 'secrets.json'
data:
DATABASE_URL: ${{ secrets.DATABASE_URL }}
COOKIE_SECRET: ${{ secrets.COOKIE_SECRET }}
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
APP_URL: ${{ secrets.APP_URL }}
CLOUDFLARE_TURNSTILE_SECRET_KEY: ${{ secrets.CLOUDFLARE_TURNSTILE_SECRET_KEY }}
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- name: Upload secrets
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages secret bulk secrets.json --project-name=instant-postgres-api
wranglerVersion: 3.58.0
- name: Deploy
uses: AdrianGonz97/refined-cf-pages-action@v1
with:
githubToken: ${{ secrets.GH_TOKEN }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: instant-postgres-api
directory: ./dist
workingDirectory: ./apps/api
deploymentName: api
branch: main