deploy.ts 952 B

123456789101112131415161718
  1. #!/usr/bin/env bun
  2. // Publish the built playlist + guide to chillidonut.com's junk drawer on GCS.
  3. // Uses `cp` (NOT `rsync`) so it only adds/overwrites these two objects — anything
  4. // else already in the bucket's junk/ is left untouched (never synced or deleted).
  5. // `-Z` gzips on upload and sets Content-Encoding: gzip (served compressed on the
  6. // wire; ~32 MB guide -> ~3-4 MB). url-tvg stays …/guide.xml — do NOT pre-gzip.
  7. import { $ } from 'bun';
  8. import { existsSync } from 'node:fs';
  9. const HERE = import.meta.dir;
  10. const DEST = 'gs://chillidonut.com/junk/iptv/';
  11. const files = ['iptv.m3u', 'guide.xml'].map((f) => `${HERE}/${f}`);
  12. for (const f of files)
  13. if (!existsSync(f)) { console.error(`missing ${f} — run \`bun refresh.ts\` first`); process.exit(1); }
  14. await $`gsutil -m -h ${'Cache-Control:public,max-age=3600'} cp -Z ${files} ${DEST}`;
  15. console.log(`uploaded ${files.length} files -> ${DEST} (gzipped, Content-Encoding: gzip)`);