From 08b32d8d19c7dcd38b7b2ffe2a4f535b40ad16e1 Mon Sep 17 00:00:00 2001 From: zzak Date: Sun, 8 Jun 2025 07:48:34 +0900 Subject: [PATCH] Use Cloudflare Pages for website PR previews --- .github/workflows/pages.yml | 31 +++++++++++++++++++++++++++++++ _config_pages.yml | 2 ++ 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/pages.yml create mode 100644 _config_pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 000000000..e6f2d0bb5 --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,31 @@ +on: + pull_request: + types: [opened, synchronize, reopened] +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: read + name: Deploy to Cloudflare Pages + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.2.3' + bundler-cache: true + - name: Install Dependencies + run: bundle install + - name: Build Static Site + run: | + bundle exec jekyll build \ + --destination preview \ + --config _config.yml,_config_pages.yml + - name: Deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy preview --project-name=rails-website-preview + gitHubToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/_config_pages.yml b/_config_pages.yml new file mode 100644 index 000000000..17becdfab --- /dev/null +++ b/_config_pages.yml @@ -0,0 +1,2 @@ +exclude: + - vendor