actions / jekyll-build-pages

A simple GitHub Action for producing Jekyll build artifacts compatible with GitHub Pages.
https://pages.github.com
MIT License
80 stars 36 forks source link

Confusion on whether to use this versus custom workflow #134

Open KonradHoeffner opened 5 days ago

KonradHoeffner commented 5 days ago

In the past I was using another Docker based Jekyll action https://github.com/helaili/jekyll-action [1]. However this recently stopped working and that action was deprecated with the notice remarking that using Docker for Jekyll is bad and should be avoided [2]. After much research and troubleshooting, I finally arrived at a working solution [3] but then I found this action which is described as "part of the official support", however it uses a Docker based action again, which I just moved away from because it should not be used according to https://github.com/helaili/jekyll-action.

Now I'm thoroughly confused: who is right now? Should I stick with the custom workflow [3] or adopt the official solution even though it uses a Docker based action that is supposed to be slow, hard to debug and not reproducible?

[1] Like this:

  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/cache@v3
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }}
          restore-keys: |
            ${{ runner.os }}-gems-
      - uses: helaili/jekyll-action@v2
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          target_branch: 'static'

[2]

GitHub has a new way to publish a static site to Pages using GitHub Actions. This means you can now build with the Jekyll command (or something else) and use actions to publish, all using regular steps. This removes the need for Docker based actions and gives you all the freedom to configure the execution environment (versions of Ruby, extra dependencies...), it is a lot faster, easier to debug and closer to what you can run on your local machine.

[3]

name: Build and deploy Jekyll site to GitHub Pages

on:
  workflow_dispatch:
  push:
    branches:
      - master
permissions:
  contents: read
  pages: write
  id-token: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: ruby/setup-ruby@v1
        with:
          ruby-version: '3'
          bundler-cache: true  # runs 'bundle install' and caches installed gems automatically
      - uses: actions/configure-pages@v5 
      - run: bundle exec jekyll build
      - uses: actions/upload-pages-artifact@v3

  deploy:
    runs-on: ubuntu-latest
    needs: build
    steps:
      - uses: actions/deploy-pages@v4
KonradHoeffner commented 5 days ago

P.S.: I also noted that all those new ways do not seem to upload those files to a branch, like "static" or "gh-pages", but instead seems to skip such a branch completely, is that correct? In that case it would not work for my use case, because the github-pages site is just used for testing, while we checkout this branch on the web server for production after verifying with the github-pages site.