From ec676f2b921ab106c31d594e1700f8d20f83609a Mon Sep 17 00:00:00 2001 From: yunchan Date: Mon, 17 Aug 2026 21:12:50 +0000 Subject: [PATCH] =?UTF-8?q?site-deploy=20=EC=9B=8C=ED=81=AC=ED=94=8C?= =?UTF-8?q?=EB=A1=9C:=20=EB=A6=B4=EB=A6=AC=EC=8A=A4=20Publish=20=EC=8B=9C?= =?UTF-8?q?=20MEDIABROWSER=20=EC=82=AC=EC=9D=B4=ED=8A=B8=20=EC=9E=90?= =?UTF-8?q?=EB=8F=99=20=EC=9E=AC=EB=B0=B0=ED=8F=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .forgejo/workflows/site-deploy.yml | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .forgejo/workflows/site-deploy.yml diff --git a/.forgejo/workflows/site-deploy.yml b/.forgejo/workflows/site-deploy.yml new file mode 100644 index 0000000..2f9339e --- /dev/null +++ b/.forgejo/workflows/site-deploy.yml @@ -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 배포 실패" }