forked from trestleinc/replicate
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (69 loc) · 2.32 KB
/
Copy pathdeploy-sveltekit.yml
File metadata and controls
84 lines (69 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Deploy Replicate SvelteKit
on:
workflow_run:
workflows: ['CI']
types: [completed]
branches: [main]
workflow_dispatch:
inputs:
environment:
description: 'Environment to deploy'
required: true
default: 'preview'
type: choice
options:
- preview
- production
jobs:
build-and-deploy-preview:
if: >-
(github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'preview') ||
(github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')
runs-on: ubuntu-latest
name: Deploy Preview
environment: preview
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build packages
run: bun run build:packages
- name: Build App
run: bun run build:sveltekit
env:
PUBLIC_CONVEX_URL: ${{ vars.PUBLIC_CONVEX_URL }}
- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: apps/sveltekit
environment: preview
build-and-deploy-production:
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production' }}
runs-on: ubuntu-latest
name: Deploy Production
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build packages
run: bun run build:packages
- name: Deploy to Convex & Build App
run: bunx convex deploy --cmd-url-env-var-name PUBLIC_CONVEX_URL --cmd 'bun run build:sveltekit'
env:
CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }}
- name: Deploy to Cloudflare Workers
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
workingDirectory: apps/sveltekit
environment: production