feat(supporters): 워커 publish 단계 · 배포 뒤 색인 작업 자동화 + 사람 체크리스트

- scripts/publish_site.mjs: 라이브 확인(홈·robots·sitemap·noindex), IndexNow(빙·네이버) 사이트맵 URL 알림, Google Search Console 사이트맵 제출·URL 색인 상태(서비스 계정 있을 때), 사람 몫 체크리스트(publish-checklist.md, status.humanTasks)
- 워커: data 단계에서 IndexNow 키 파일 생성, --indexable(noindex 헤더 제거·승인 글만), --domain(vercel domains add·SITE_URL), deploy 뒤 publish 단계, 상태 published_pending_tasks
- Base.astro: google/naver 소유 확인 메타(site.json googleSiteVerification·naverSiteVerification)
- 완료 정의: 배포가 아니라 색인 작업과 사람 체크리스트까지 (haewon 2026-09-11)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Fable 5.1 committed 2026-09-11 15:28:48 +09:00
1 parent c044546614
commit 891b7bdece
9 files changed
+434 -34

No files matched your search

+30 -5
View File
@@ -26,7 +26,7 @@ const clinic = opt('clinic'); const url = opt('url');
if (!clinic || !url) { console.error('사용법: --clinic <id> --url <https://...>'); process.exit(2); }
const WORK = resolve(opt('work', join(homedir(), 'supporters-builds', clinic)));
const today = new Date().toISOString().slice(0, 10);
const PHASES = ['evidence', 'ocr', 'data', 'discover', 'youtube', 'news', 'images', 'tourism', 'recovery', 'planner', 'inputs', 'briefs', 'generate', 'build', 'deploy', 'done'];
const PHASES = ['evidence', 'ocr', 'data', 'discover', 'youtube', 'news', 'images', 'tourism', 'recovery', 'planner', 'inputs', 'briefs', 'generate', 'build', 'deploy', 'publish', 'done'];
const startFrom = opt('from', 'evidence');
(function loadEnv() { const p = join(ROOT, '.env'); if (!existsSync(p)) return; for (const line of readFileSync(p, 'utf8').split('\n')) { const m = line.match(/^\s*([A-Z0-9_]+)\s*=\s*(.*)\s*$/); if (m && !process.env[m[1]]) process.env[m[1]] = m[2].replace(/^["']|["']$/g, ''); } })();
@@ -112,6 +112,13 @@ await phase('data', () => {
if (existsSync(join(KEEP, 'posts'))) cpSync(join(KEEP, 'posts'), POSTS, { recursive: true });
if (existsSync(join(KEEP, 'videos.json'))) cpSync(join(KEEP, 'videos.json'), join(DATA, 'videos.json'));
for (const rel of ['astro.config.mjs', 'vercel.json']) { const p = join(SITE, rel); writeFileSync(p, readFileSync(p, 'utf8').split('__CLINIC_ID__').join(clinic)); }
// 색인 허용 빌드(--indexable): noindex 헤더 제거 + PUBLIC_INDEXABLE=true(승인된 글만 발행). 정식 도메인(--domain)이 있으면 SITE_URL 을 그 주소로.
const liveUrl = opt('domain') ? `https://${opt('domain').replace(/^https?:\/\//, '').replace(/\/$/, '')}` : `https://supporters-${clinic}.vercel.app`;
{ const vp = join(SITE, 'vercel.json'); const vj = readJson(vp); vj.build = vj.build ?? {}; vj.build.env = { ...(vj.build.env ?? {}), SITE_URL: liveUrl, PUBLIC_INDEXABLE: flag('indexable') ? 'true' : 'false' };
if (flag('indexable')) vj.headers = (vj.headers ?? []).filter((h) => !(h.headers ?? []).some((x) => x.key === 'X-Robots-Tag')); writeJson(vp, vj); }
// IndexNow 키: 사이트마다 하나. public/<key>.txt 로 두면 빙·네이버가 소유를 확인한다. 검색엔진 소유 확인 메타 값은 briefs/<clinic>/clinic.json 의 site 로 들어온다(inputs 단계).
{ const sp = join(DATA, 'site.json'); const sj = readJson(sp); if (!sj.indexNowKey) { sj.indexNowKey = [...Array(32)].map(() => Math.floor(Math.random() * 16).toString(16)).join(''); writeJson(sp, sj); }
mkdirSync(join(SITE, 'public'), { recursive: true }); writeFileSync(join(SITE, 'public', `${sj.indexNowKey}.txt`), sj.indexNowKey); }
cpSync(join(EV, 'home_text.txt'), join(SITE, 'scripts', 'home_text.txt'));
// 팩트 시트: 후보 중 첫 값. 사람이 대조하기 전까지 "확인 대기"가 붙는 필드가 많다(v2 §4-5).
@@ -429,12 +436,30 @@ await phase('deploy', () => {
const project = `supporters-${clinic}`;
const link = run('vercel', ['link', '--yes', '--project', project], { cwd: SITE });
if (!link.ok) throw new Error(`vercel link 실패\n${tail(link.out)}`);
const dep = run('vercel', ['deploy', '--prod', '--yes'], { cwd: SITE, env: { SITE_URL: `https://${project}.vercel.app` } });
const domain = opt('domain') ? opt('domain').replace(/^https?:\/\//, '').replace(/\/$/, '') : '';
if (domain) { const d = run('vercel', ['domains', 'add', domain, project, '--yes'], { cwd: SITE }); status.report = { ...(status.report ?? {}), domain: d.ok ? `연결 요청됨 ${domain}` : `도메인 추가 실패(DNS·소유 확인 필요)\n${tail(d.out, 3)}` }; }
const dep = run('vercel', ['deploy', '--prod', '--yes'], { cwd: SITE, env: { SITE_URL: domain ? `https://${domain}` : `https://${project}.vercel.app` } });
const m = dep.out.match(/https:\/\/[^\s]+\.vercel\.app/g);
if (!dep.ok || !m) throw new Error(`vercel deploy 실패\n${tail(dep.out)}`);
status.previewUrl = `https://${project}.vercel.app`;
return status.previewUrl;
status.liveUrl = domain ? `https://${domain}` : status.previewUrl;
return status.liveUrl;
});
await phase('done', async () => { await setStatus({ status: 'preview' }); return `status.json → ${statusPath}`; });
console.log(`\n완료: ${status.posts.length}편 · ${status.previewUrl ?? '미배포'} · ${WORK}`);
// 8. 발행(색인) 단계: 배포가 끝이 아니다. 라이브 확인 → IndexNow(빙·네이버) → Google Search Console(서비스 계정 있을 때) → 사람 체크리스트(네이버 등록·GSC 소유 확인·도메인·법무). haewon 결정 2026-09-11.
await phase('publish', () => {
if (!status.previewUrl) return '건너뜀 (미배포)';
const argv = ['scripts/publish_site.mjs', '--clinic', clinic, '--site', SITE, '--url', status.liveUrl || status.previewUrl, '--work', WORK];
if (flag('indexable')) argv.push('--indexable');
const r = run('node', argv);
const m = r.out.match(/__PUBLISH_JSON__(.+)$/m);
const pub = m ? JSON.parse(m[1]) : null;
if (!r.ok || !pub) return { warn: true, summary: `발행 단계 실패 (체크리스트 없이 종료)\n${tail(r.out, 4)}` };
status.report = { ...(status.report ?? {}), publish: pub };
status.humanTasks = pub.humanTasks;
const n = pub.humanTasks.length;
return `색인 허용 ${pub.indexable ? '예' : '아니오'} · IndexNow ${pub.indexnow?.status ?? pub.indexnow?.skipped ?? '-'} · GSC ${pub.google?.sitemapSubmit ?? pub.google?.skipped ?? '-'} · 사람이 할 일 ${n}건 → ${join(WORK, 'publish-checklist.md')}`;
});
await phase('done', async () => { await setStatus({ status: flag('indexable') ? (status.humanTasks?.length ? 'published_pending_tasks' : 'published') : 'preview' }); return `status.json → ${statusPath}`; });
console.log(`\n완료: ${status.posts.length}편 · ${status.liveUrl ?? status.previewUrl ?? '미배포'} · ${WORK}${status.humanTasks?.length ? `\n사람이 할 일 ${status.humanTasks.length}건 (publish-checklist.md):\n - ${status.humanTasks.join('\n - ')}` : ''}`);