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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue