Some checks failed
Deploy to Cloudflare Pages (cobalt, wrangler-action) / build-and-deploy (push) Failing after 30s
40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
name: Deploy to Cloudflare Pages (cobalt, wrangler-action)
|
|
|
|
on:
|
|
push:
|
|
branches: ["main", "master"]
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CF_PAGES_PROJECT: ${{ vars.CF_PAGES_PROJECT }} # 例: blog
|
|
PROD_BRANCH: "main"
|
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Install cobalt (prebuilt)
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
apt-get update && apt-get install -y ca-certificates curl tar git
|
|
curl -fsSL https://zyedidia.github.io/eget.sh | sh
|
|
./eget cobalt-org/cobalt.rs --to /usr/local/bin/cobalt
|
|
cobalt --version
|
|
|
|
- name: Build site with cobalt
|
|
run: cobalt build # 出力: ./_site
|
|
|
|
# --- Wrangler ActionでPagesにデプロイ ---
|
|
- name: Deploy to Cloudflare Pages
|
|
uses: https://github.com/cloudflare/wrangler-action@v3
|
|
with:
|
|
apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }}
|
|
command: pages deploy _site --project-name "${{ env.CF_PAGES_PROJECT }}" --branch "${{ github.ref_name || env.GITEA_REF_NAME || 'main' }}"
|