Files
blog/.gitea/workflows/deploy-pages.yaml
Yuya KAMATAKI f049d785e7
Some checks failed
Deploy to Cloudflare Pages (cobalt) / build-and-deploy (push) Failing after 2m36s
Gitea Actionsによるデプロイを追加
2025-09-07 15:11:37 +09:00

66 lines
2.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Deploy to Cloudflare Pages (cobalt)
on:
push:
branches: ["main", "master"]
workflow_dispatch: {}
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v4
# Giteaは絶対URLでの外部Action取得に対応。:contentReference[oaicite:6]{index=6}
- name: Setup Node for Wrangler
uses: https://github.com/actions/setup-node@v4
with:
node-version: "20"
- name: Install cobalt (prebuilt)
shell: bash
run: |
if ! command -v curl >/dev/null 2>&1; then
(apt-get update && apt-get install -y curl) \
|| (apk add --no-cache curl) \
|| (dnf -y install curl) \
|| (pacman -Sy --noconfirm curl)
fi
curl -LSfs https://raw.githubusercontent.com/crate-ci/gh-install/master/v1/install.sh \
| sh -s -- --git cobalt-org/cobalt.rs --crate cobalt
cobalt --version
# cobaltのインストール手順prebuilt。:contentReference[oaicite:7]{index=7}
- name: Build site with cobalt
run: cobalt build
# 既定の出力は ./_site。:contentReference[oaicite:8]{index=8}
- name: Install Wrangler
run: npm i -g wrangler@latest
- name: Compute BRANCH_NAME
id: branch
shell: bash
run: |
bn="${GITHUB_REF_NAME:-${GITEA_REF_NAME:-}}"
if [ -z "$bn" ] && [ -n "${GITHUB_REF:-${GITEA_REF:-}}" ]; then
ref="${GITHUB_REF:-${GITEA_REF}}"
bn="${ref##*/}"
fi
echo "BRANCH_NAME=$bn" >> "$GITHUB_ENV"
- name: Deploy to Cloudflare Pages
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CF_PAGES_PROJECT: ${{ vars.CF_PAGES_PROJECT }}
run: |
test -n "$CF_PAGES_PROJECT"
npx wrangler pages deploy "_site" \
--project-name "$CF_PAGES_PROJECT" \
--account-id "$CLOUDFLARE_ACCOUNT_ID" \
--branch "$BRANCH_NAME"
# CIでのwrangler deploy手順に準拠。:contentReference[oaicite:9]{index=9}