author: @kawam tags:#cloudflare#tutorial


Pertama-tama buatlah token untuk edit Cloudflare Pages di halaman profile cloudflare.

Pastikan untuk men-setting Cloudflare Pages:Edit.

Edit file .github/workflows/deploy.yaml

name: Deploy to Cloudflare Pages
 
on:
  push:
    branches:
      - main # notice that we use main branch here.
 
jobs:
  deploy:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod
 
      - name: Build Link Index
        uses: jackyzha0/hugo-obsidian@v2.19
        with:
          index: true
          input: content
          output: assets/indices
          root: .
 
      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.96.0'
          extended: true
 
      - name: Build
        run: hugo --minify
      
      - name: Publish to Cloudflare Pages
        uses: cloudflare/pages-action@v1
        with:
            apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
            accountId: ${{ secrets.ACCOUNT_ID }}
            projectName: hit-wikis
            directory: ./public

Jangan lupa untuk mengganti baseURL yang ada di config.toml sesuai dengan domain cloudflare.