site-deploy 워크플로: 릴리스 Publish 시 MEDIABROWSER 사이트 자동 재배포
All checks were successful
site-deploy / deploy (release) Successful in 22s

This commit is contained in:
yunchan 2026-08-17 21:12:50 +00:00
parent 246e6251b9
commit ec676f2b92

View file

@ -0,0 +1,35 @@
# 릴리스가 Publish 되면 MEDIABROWSER 사이트(releases.json)를 자동 재배포한다.
# 사이트 소스는 비공개 client 저장소에 있어 CLIENT_TOKEN(읽기 PAT)으로 체크아웃한다.
# 수동 재배포는 workflow_dispatch 로도 가능.
name: site-deploy
on:
release:
types: [published]
workflow_dispatch:
jobs:
deploy:
runs-on: windows
defaults: { run: { shell: pwsh } }
steps:
- name: client 저장소 체크아웃 (site/ 사용)
env: { CLIENT_TOKEN: "${{ secrets.CLIENT_TOKEN }}" }
run: |
$u = [Uri]$env:GITHUB_SERVER_URL
$url = "$($u.Scheme)://actions:$($env:CLIENT_TOKEN)@$($u.Authority)/Video-Downloader/client.git"
if (-not (Test-Path .git)) { git init -q . }
if (git remote | Select-String -Quiet '^origin$') { git remote set-url origin $url } else { git remote add origin $url }
git fetch -q --depth 1 origin refs/heads/main
if ($LASTEXITCODE -ne 0) { throw "fetch 실패" }
git checkout -q -f FETCH_HEAD
if ($LASTEXITCODE -ne 0) { throw "checkout 실패" }
git clean -qfdx
- name: releases.json 생성 + Cloudflare Pages 배포
env:
CLOUDFLARE_API_TOKEN: "${{ secrets.CLOUDFLARE_API_TOKEN }}"
CLOUDFLARE_ACCOUNT_ID: "${{ secrets.CLOUDFLARE_ACCOUNT_ID }}"
run: |
node site/fetch-releases.mjs
if ($LASTEXITCODE -ne 0) { throw "releases.json 생성 실패" }
npx wrangler pages deploy site --project-name mediabrowser --branch main --commit-dirty=true
if ($LASTEXITCODE -ne 0) { throw "Pages 배포 실패" }