@@ -4,7 +4,6 @@ import { mkdirSync, rmSync, cpSync, readFileSync, writeFileSync, createReadStrea
44import { tmpdir } from 'node:os' ;
55import { join , resolve } from 'node:path' ;
66import { createHash } from 'node:crypto' ;
7- import { put } from '@vercel/blob' ;
87
98function exec ( cmd , opts = { } ) {
109 return execSync ( cmd , { stdio : 'inherit' , ...opts } ) ;
@@ -24,11 +23,7 @@ async function main() {
2423 const repoRoot = resolve ( process . cwd ( ) ) ;
2524 const serverDir = repoRoot ; // server repo root
2625
27- const token = process . env . BLOB_READ_WRITE_TOKEN ;
28- if ( ! token ) {
29- console . error ( 'Missing env BLOB_READ_WRITE_TOKEN' ) ;
30- process . exit ( 1 ) ;
31- }
26+ // No external uploads here; this script only builds artifacts in CI.
3227
3328 // Target selection (defaults to host platform/arch). Allows CI matrix to override.
3429 const targetOs = process . env . TARGET_OS || ( process . platform === 'darwin' ? 'darwin' : ( process . platform === 'linux' ? 'linux' : 'darwin' ) ) ;
@@ -131,48 +126,19 @@ async function main() {
131126 console . log ( `[release] Packed ${ ( s . size / 1024 / 1024 ) . toFixed ( 1 ) } MB, sha256=${ digest . slice ( 0 , 8 ) } ...` ) ;
132127 } catch { }
133128
134- // If artifacts-only mode, stop here after writing files; the workflow will upload
135-
136- if ( publishMode === 'full' ) {
137- // Legacy single-arch publish: upload directly to Blob (kept for local use only)
138- const artifactPath = `pocket-server/${ version } /pocket-server-${ osArchKey } .tar.gz` ;
139- console . log ( `[release] Uploading to Blob: ${ artifactPath } ...` ) ;
140- const { url : tgzUrl } = await put ( artifactPath , readFileSync ( outTgz ) , {
141- access : 'public' , addRandomSuffix : false , token, contentType : 'application/gzip' , cacheControlMaxAge : 31536000 ,
142- } ) ;
143- await put ( `${ artifactPath } .sha256` , readFileSync ( shaPath ) , {
144- access : 'public' , addRandomSuffix : false , token, contentType : 'text/plain' , cacheControlMaxAge : 31536000 ,
145- } ) ;
146- console . log ( `[release] Upload complete: ${ tgzUrl } ` ) ;
147- // Build manifest with only this target (legacy single-arch behavior)
148- const manifest = {
149- version,
150- node : nodeVersion ,
151- files : {
152- [ osArchKey ] : { url : tgzUrl , sha256 : digest } ,
153- }
154- } ;
155-
156- const { url : uploadedManifestUrl } = await put ( 'pocket-server/latest.json' , Buffer . from ( JSON . stringify ( manifest , null , 2 ) ) , {
157- access : 'public' , addRandomSuffix : false , allowOverwrite : true , token, contentType : 'application/json' , cacheControlMaxAge : 60 ,
158- } ) ;
159-
160- console . log ( '\nRelease completed' ) ;
161- console . log ( 'Version:' , version ) ;
162- console . log ( 'Tarball:' , tgzUrl ) ;
163- console . log ( 'Manifest:' , uploadedManifestUrl ) ;
164- console . log ( '\nSet INSTALL_MANIFEST_URL to the Manifest URL if not already set.' ) ;
165- } else {
166- // Artifacts-only: write metadata JSON for the aggregator
167- if ( metadataPath ) {
168- const meta = { version, node : nodeVersion , os : targetOs , arch : targetArch , url : '' , sha256 : digest } ;
169- writeFileSync ( metadataPath , JSON . stringify ( meta , null , 2 ) ) ;
170- console . log ( `[release] Wrote metadata: ${ metadataPath } ` ) ;
171- }
172- console . log ( '\nArtifact upload completed' ) ;
173- console . log ( 'Version:' , version ) ;
174- console . log ( 'Tarball:' , tgzUrl ) ;
129+ // Make artifacts available at a stable path (repo root) for the workflow to upload
130+ const outTgzRepo = join ( repoRoot , `pocket-server-${ osArchKey } .tar.gz` ) ;
131+ const shaPathRepo = `${ outTgzRepo } .sha256` ;
132+ try { cpSync ( outTgz , outTgzRepo ) ; } catch { }
133+ try { writeFileSync ( shaPathRepo , `${ digest } ` ) ; } catch { }
134+
135+ // Write metadata JSON for the publish step
136+ if ( metadataPath ) {
137+ const meta = { version, node : nodeVersion , os : targetOs , arch : targetArch , url : '' , sha256 : digest } ;
138+ writeFileSync ( metadataPath , JSON . stringify ( meta , null , 2 ) ) ;
139+ console . log ( `[release] Wrote metadata: ${ metadataPath } ` ) ;
175140 }
141+ console . log ( `\nArtifacts ready:\n ${ outTgzRepo } \n ${ shaPathRepo } ` ) ;
176142}
177143
178144main ( ) . catch ( ( e ) => { console . error ( e ) ; process . exit ( 1 ) ; } ) ;
0 commit comments