Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ jobs:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Setup Deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.8.2

- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand Down Expand Up @@ -268,6 +273,11 @@ jobs:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Setup Deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.8.2

- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand Down Expand Up @@ -382,6 +392,11 @@ jobs:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Setup Deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.8.2

- name: Install dependencies
run: pnpm install --frozen-lockfile

Expand Down Expand Up @@ -492,6 +507,11 @@ jobs:
cache: 'pnpm'
registry-url: 'https://registry.npmjs.org'

- name: Setup Deno
uses: denoland/setup-deno@667a34cdef165d8d2b2e98dde39547c9daac7282 # v2.0.4
with:
deno-version: v2.8.2

- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Configure git
Expand Down
43 changes: 24 additions & 19 deletions scripts/publish-to-jsr.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { execSync } from 'child_process'
import { spawnSync } from 'child_process'
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs'
import { dirname, join } from 'path'

Expand Down Expand Up @@ -69,15 +69,6 @@ function getArg(name: string): string | undefined {
const tag = getArg('tag') || 'latest'
const dryRun = process.argv.includes('--dry-run')

function safeExec(cmd: string, opts = {}) {
try {
return execSync(cmd, { stdio: 'inherit', ...opts })
} catch (err) {
console.error(`❌ Command failed: ${cmd}`)
throw err
}
}

async function publishToJsr() {
console.log(`\n📦 Publishing packages to JSR (tag: ${tag})...\n`)

Expand Down Expand Up @@ -125,15 +116,29 @@ async function publishToJsr() {
console.log(`\n📤 Publishing @supabase/${pkg}@${version} to JSR...`)

try {
// Change to package directory and publish
// Note: In GitHub Actions, authentication happens automatically via OIDC
// Provenance is automatically enabled when using OIDC (no flag needed)
// Local publishing will prompt for interactive browser authentication
const publishCmd = dryRun
? `cd "${packagePath}" && pnpm exec jsr publish --dry-run --allow-dirty`
: `cd "${packagePath}" && pnpm exec jsr publish --allow-dirty`

safeExec(publishCmd)
// Call `deno publish` directly (instead of `pnpm exec jsr publish`) so we
// use the pinned Deno from `denoland/setup-deno` in publish.yml rather
// than whatever the `jsr` npm wrapper downloads from dl.deno.land at
// runtime. Timeout caps JSR queue stranding (jsr-io/jsr#1448) at 10 min
// instead of letting the unbounded poll loop wedge the workflow.
const args = ['publish', '--allow-dirty']
if (dryRun) args.push('--dry-run')
console.log(` Command: deno ${args.join(' ')}`)
const result = spawnSync('deno', args, {
cwd: packagePath,
stdio: 'inherit',
timeout: 10 * 60 * 1000,
killSignal: 'SIGKILL',
})
if (result.signal === 'SIGKILL') {
throw new Error(
`deno publish for ${pkg} timed out after 10 minutes — likely JSR task stranding, see jsr-io/jsr#1448`
)
}
if (result.error) throw result.error
if (result.status !== 0) {
throw new Error(`deno publish for ${pkg} exited with status ${result.status}`)
}

console.log(`✅ Successfully published @supabase/${pkg}@${version} to JSR`)
results.push({ package: pkg, success: true })
Expand Down
Loading