ci: add .forgejo/workflows/deploy-site.yml for Cloudflare Pages auto-deployment to d3ro.chanpaca.net
This commit is contained in:
parent
9dd52f0626
commit
e87567fa90
3 changed files with 106 additions and 0 deletions
37
.forgejo/workflows/deploy-site-windows.yml
Normal file
37
.forgejo/workflows/deploy-site-windows.yml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
name: deploy-site-windows
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
deploy-win:
|
||||
runs-on: windows
|
||||
defaults: { run: { shell: pwsh } }
|
||||
steps:
|
||||
- name: checkout
|
||||
env: { CI_TOKEN: "${{ github.token }}" }
|
||||
run: |
|
||||
$u = [Uri]$env:GITHUB_SERVER_URL
|
||||
$url = "$($u.Scheme)://actions:$($env:CI_TOKEN)@$($u.Authority)/$($env:GITHUB_REPOSITORY).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 $env:GITHUB_REF
|
||||
git checkout -q -f FETCH_HEAD
|
||||
git clean -qfdx
|
||||
|
||||
- name: 사이트 빌드 & 바이너리 동기화
|
||||
run: |
|
||||
npm install --prefix site
|
||||
npm run build --prefix site
|
||||
node scripts/ci/sync-and-publish-forgejo-release.mjs
|
||||
|
||||
- name: Cloudflare Pages 배포
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: "${{ secrets.CF_API_TOKEN || secrets.CLOUDFLARE_API_TOKEN }}"
|
||||
CLOUDFLARE_ACCOUNT_ID: "${{ secrets.CF_ACCOUNT_ID || secrets.CLOUDFLARE_ACCOUNT_ID }}"
|
||||
run: |
|
||||
if ($env:CLOUDFLARE_API_TOKEN) {
|
||||
npx --yes wrangler@latest pages deploy site/dist --project-name d3ro --branch main --commit-dirty=true
|
||||
}
|
||||
50
.forgejo/workflows/deploy-site.yml
Normal file
50
.forgejo/workflows/deploy-site.yml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
name: deploy-site
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: linux-builder
|
||||
steps:
|
||||
- name: checkout
|
||||
env: { CI_TOKEN: "${{ github.token }}" }
|
||||
run: |
|
||||
proto="${GITHUB_SERVER_URL%%://*}"; host="${GITHUB_SERVER_URL#*://}"
|
||||
url="$proto://actions:${CI_TOKEN}@${host%/}/${GITHUB_REPOSITORY}.git"
|
||||
[ -d .git ] || git init -q .
|
||||
git remote remove origin 2>/dev/null || true
|
||||
git remote add origin "$url"
|
||||
git fetch -q --depth 1 origin "$GITHUB_REF"
|
||||
git checkout -q -f FETCH_HEAD
|
||||
git clean -qfdx
|
||||
|
||||
- name: 의존성 설치 및 사이트 빌드
|
||||
run: |
|
||||
npm ci --prefix site || npm install --prefix site
|
||||
npm run build --prefix site
|
||||
node scripts/ci/sync-and-publish-forgejo-release.mjs || true
|
||||
|
||||
- name: Cloudflare Pages 배포 (d3ro.chanpaca.net)
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: "${{ secrets.CF_API_TOKEN || secrets.CLOUDFLARE_API_TOKEN }}"
|
||||
CLOUDFLARE_ACCOUNT_ID: "${{ secrets.CF_ACCOUNT_ID || secrets.CLOUDFLARE_ACCOUNT_ID }}"
|
||||
run: |
|
||||
if [ -n "$CLOUDFLARE_API_TOKEN" ]; then
|
||||
echo "Cloudflare Pages 배포 시작 (d3ro)..."
|
||||
npx --yes wrangler@latest pages deploy site/dist \
|
||||
--project-name d3ro \
|
||||
--branch main \
|
||||
--commit-dirty=true || \
|
||||
npx --yes wrangler@latest pages deploy site/dist \
|
||||
--project-name d3ro-voice \
|
||||
--branch main \
|
||||
--commit-dirty=true
|
||||
else
|
||||
echo "CLOUDFLARE_API_TOKEN 없음"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue