snikproject / snik.eu

Website for SNIK – Semantisches Netz des Informationsmanagements im Krankenhaus
https://www.snik.eu/
MIT License
0 stars 0 forks source link

error with jekyll action #4

Closed KonradHoeffner closed 1 month ago

KonradHoeffner commented 1 month ago
50s
Run helaili/jekyll-action@v2
/usr/bin/docker run --name bbe5b768e7b743eb94d91addc6e5d317_86fa90 --label 414327 --workdir /github/workspace --rm -e "INPUT_TOKEN" -e "INPUT_TARGET_BRANCH" -e "INPUT_JEKYLL_ENV" -e "INPUT_JEKYLL_SRC" -e "INPUT_JEKYLL_BUILD_OPTIONS" -e "INPUT_GEM_SRC" -e "INPUT_TARGET_PATH" -e "INPUT_BUILD_ONLY" -e "INPUT_BUILD_DIR" -e "INPUT_KEEP_HISTORY" -e "INPUT_PRE_BUILD_COMMANDS" -e "INPUT_BUNDLER_VERSION" -e "INPUT_COMMIT_AUTHOR" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/snik.eu/snik.eu":"/github/workspace" 414327:bbe5b768e7b743eb94d91addc6e5d317
Starting the Jekyll Action
Remote branch is static
Resolving bundler version from Gemfile.lock
ERROR:  Error installing bundler:
    There are no versions of bundler (= 2.5.17) compatible with your Ruby & RubyGems
    bundler requires Ruby version >= 3.0.0. The current ruby version is 2.7.8.225.

This probably needs to be fixed for all similar sites: SNIK, HITO, ANNO.

KonradHoeffner commented 1 month ago

https://github.com/helaili/jekyll-action is marked as deprecated, I think it doesn't support Ruby version 3 and we need to change the workflow.

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.

You can check the documentation for more information on how to do this.

Maintaining this action was a great experience, but as there is now a better solution availabe I do encourage everyone to move over.

KonradHoeffner commented 1 month ago

I couldn't find a clear gold standard way of doing it like helaili/jekyll action describes it and ended up with this working solution:

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

However contrary to the statement from helaili/jekyll action, there is https://github.com/actions/jekyll-build-pages which is "part of the official support for building Pages with Actions", so maybe we should switch to that?

KonradHoeffner commented 1 month ago

This should also now be adopted for HITO and ANNO, however I first want to wait for responses to https://github.com/actions/jekyll-build-pages/issues/134 on whether it is better to use https://github.com/actions/jekyll-build-pages/ instead.

KonradHoeffner commented 1 month ago

This needs to be changed because the deploy-pages action does not create a branch, so we cannot check it out on the webserver. https://github.com/actions/jekyll-build-pages seems to upload it to an artifact, so it seems https://github.com/JamesIves/github-pages-deploy-action is actually the one we need.