Skip to content

Publish to Cloudflare Pages #20

Publish to Cloudflare Pages

Publish to Cloudflare Pages #20

Workflow file for this run

name: Publish to Cloudflare Pages
on:
push:
workflow_dispatch:
schedule:
- cron: '0 15 * * *' # 00:00 JST
jobs:
publish:
runs-on: ubuntu-latest
if: github.repository == 'tut-cc/blog'
permissions:
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- uses: actions/cache@v3
id: node_modules_cache_id
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- run: echo '${{ toJSON(steps.node_modules_cache_id.outputs) }}'
- if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }}
run: npm install
- name: Build
run: npm run build
env:
NOTION_API_SECRET: ${{ secrets.NOTION_API_SECRET }}
DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }}
- name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy dist --project-name blog