Skip to content

Instantly share code, notes, and snippets.

@syakesaba
Last active February 13, 2025 16:52
Show Gist options
  • Save syakesaba/61fafeba094a4ff3c13234e3b518e9ef to your computer and use it in GitHub Desktop.
Save syakesaba/61fafeba094a4ff3c13234e3b518e9ef to your computer and use it in GitHub Desktop.
cloudflareにプッシュする jekyll.yml
# _config.ymlで以下のようにセットすること。
# url: https://<fqdn>
# baseurl: /
# repository: <github username>/<github repository name>
name: Build Jekyll site
on:
push:
branches: ["master"]
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- # https://github.com/actions/checkout
name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3' # Not needed with a .ruby-version, .tool-versions or mise.toml
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Set up Jekyll
run: gem install bundler && bundle install
- name: Build site
run: bundle exec jekyll build --baseurl ''
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: compiled-site
path: ./_site
publish:
needs: build
runs-on: ubuntu-latest
steps:
- # https://github.com/actions/download-artifact
name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: compiled-site
path: ./_site
- # https://github.com/cloudflare/wrangler-action
name: Publish to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy ./_site --project-name=${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment