File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,22 +37,14 @@ jobs:
3737 - name : Install dependencies
3838 run : pnpm install --frozen-lockfile
3939
40- - name : Inject D1 database_id into API wrangler config
40+ - name : Copy wrangler.toml from example
41+ run : cp wrangler.toml.example wrangler.toml
42+
43+ - name : Generate API wrangler.toml from example
4144 working-directory : apps/api
4245 run : |
43- set -eu
44- if grep -q 'database_name\s*=\s*"tabitabi"' wrangler.toml; then
45- if ! grep -q 'database_id' wrangler.toml; then
46- echo "Injecting database_id into apps/api/wrangler.toml"
47- awk 'BEGIN{added=0} {
48- print;
49- if ($0 ~ /database_name\s*=\s*"tabitabi"/ && added==0) {
50- printf("database_id = \"%s\"\n", ENVIRON["CLOUDFLARE_DATABASE_ID"]);
51- added=1;
52- }
53- }' wrangler.toml > wrangler.toml.tmp && mv wrangler.toml.tmp wrangler.toml
54- fi
55- fi
46+ cp wrangler.toml.example wrangler.toml
47+ sed -i "s/PLACEHOLDER_DATABASE_ID/${CLOUDFLARE_DATABASE_ID}/g" wrangler.toml
5648
5749 - name : Build all packages
5850 run : pnpm run build
Original file line number Diff line number Diff line change @@ -8,5 +8,17 @@ enabled = true
88[[d1_databases ]]
99binding = " DB"
1010database_name = " tabitabi"
11+ database_id = " PLACEHOLDER_DATABASE_ID"
12+ migrations_dir = " ../../migrations"
13+
14+ [env .production ]
15+ name = " tabitabi-api"
1116
17+ [env .production .observability ]
18+ enabled = true
19+
20+ [[env .production .d1_databases ]]
21+ binding = " DB"
22+ database_name = " tabitabi"
23+ database_id = " PLACEHOLDER_DATABASE_ID"
1224migrations_dir = " ../../migrations"
You can’t perform that action at this time.
0 commit comments