61 lines
1.6 KiB
YAML
61 lines
1.6 KiB
YAML
name: Deploy Blog to Cloudflare Pages
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
NODE_VERSION: '20'
|
|
HUGO_VERSION: '0.139.2'
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
cache: 'npm'
|
|
cache-dependency-path: oauth/package-lock.json
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v3
|
|
with:
|
|
hugo-version: ${{ env.HUGO_VERSION }}
|
|
extended: true
|
|
|
|
- name: Build OAuth components
|
|
run: |
|
|
cd oauth
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Integrate OAuth with Hugo
|
|
run: |
|
|
# Create oauth directory in static
|
|
mkdir -p my-blog/static/oauth
|
|
|
|
# Copy built assets
|
|
cp -r oauth/dist/assets/* my-blog/static/assets/ 2>/dev/null || true
|
|
cp oauth/dist/index.html my-blog/static/oauth/ 2>/dev/null || true
|
|
cp oauth/dist/client-metadata.json my-blog/static/ 2>/dev/null || true
|
|
|
|
- name: Build Hugo site
|
|
run: |
|
|
cd my-blog
|
|
TZ=Asia/Tokyo hugo --minify
|
|
|
|
- name: Deploy to Cloudflare Pages
|
|
uses: cloudflare/pages-action@v1
|
|
with:
|
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
projectName: ai-log # または ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
|
|
directory: my-blog/public
|
|
gitHubToken: ${{ secrets.GITHUB_TOKEN }} |