Skip to content

Commit 382d351

Browse files
committed
chore: check if Supabase is reachable before preparing new version
1 parent 8f54e73 commit 382d351

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

scripts/publish-version/src/publishVersion.ts

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import crypto from 'node:crypto'
2-
import fs from 'node:fs/promises'
31
import { Octokit } from '@octokit/rest'
42
import { generateChangelog, inferNextVersion } from '@radashi-org/changelog'
53
import { installDeployKey } from '@radashi-org/common/installDeployKey.ts'
64
import { execa } from 'execa'
75
import { green } from 'kleur/colors'
6+
import crypto from 'node:crypto'
7+
import fs from 'node:fs/promises'
8+
import { supabase } from 'radashi-db/supabase.ts'
89
import { sift } from 'radashi/array/sift.ts'
910
import { dedent } from 'radashi/string/dedent.ts'
1011
import { glob } from 'tinyglobby'
@@ -90,6 +91,19 @@ export async function publishVersion(args: {
9091
log(`🟢 Version ${newVersion} is available`)
9192
}
9293

94+
// Check if Supabase database is reachable
95+
try {
96+
const { error } = await supabase.from('meta').select('id').limit(1)
97+
if (error) {
98+
log('🚫 Supabase database is not reachable:', error)
99+
process.exit(1)
100+
}
101+
log('🟢 Supabase database is reachable')
102+
} catch (error) {
103+
log('🚫 Error connecting to Supabase:', error)
104+
process.exit(1)
105+
}
106+
93107
// Find all commits after this tag with a PR number in the message.
94108
const latestTag = args.tag
95109
? await execa('git', ['describe', '--tags', '--abbrev=0']).then(

0 commit comments

Comments
 (0)