helaili / jekyll-action

A GitHub Action to publish Jekyll based content as a GitHub Pages site
MIT License
250 stars 120 forks source link

Error with Invalid date not allowing site to be built #43

Closed karmanyaahm closed 4 years ago

karmanyaahm commented 4 years ago

Hi, I'm trying to implement this action on my repository at https://github.com/Beachwood-High-School/beachwood-high-school.github.io.

This is the workflows file I'm using:

name: JekyllPublish

on:
  push:
    branches: 
      - code-master

jobs:
  jekyll:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2

    # Use GitHub Actions' cache to shorten build times and decrease load on servers
    - uses: actions/cache@v1
      with:
        path: vendor/bundle
        key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
        restore-keys: |
          ${{ runner.os }}-gems-
    # Standard usage
    - uses:  helaili/jekyll-action@2.0.3
      env:
        JEKYLL_PAT: ${{ secrets.JEKYLL_PAT }}

When I the action runs, this is part of the logs:


 Configuration file: ./_config.yml
            Source: .
       Destination: build
 Incremental build: disabled. Enable with --incremental
      Generating... 
             Error: could not read file /github/workspace/vendor/bundle/ruby/2.7.0/gems/jekyll-3.8.7/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb: Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/ruby/2.7.0/gems/jekyll-3.8.7/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.
             ERROR: YOUR SITE COULD NOT BE BUILT:
                    ------------------------------------
                    Invalid date '<%= Time.now.strftime('%Y-%m-%d %H:%M:%S %z') %>': Document 'vendor/bundle/ruby/2.7.0/gems/jekyll-3.8.7/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb' does not have a valid date in the YAML front matter.

I don't understand why that is happening since I can build the website locally and I don't have a _posts directory in my website. I'm using this action so I can use more Jekyll extensions in the future. My goal is to have jekyll in the 'code-master' branch and the raw html, css, and js in the master branch so it can be published using Github pages.

Thanks

helaili commented 4 years ago

You need to update the exclude line in you _config.yml as followed:

exclude: ["package.json", "src", "node_modules", "vendor/bundle"]

Note also that this jekyll_picture_tag plugin used in _includes/sidebar seems to have requirements that we probably can't meet (see error I got below). You could transform the image yourself and just used the modified one statically.

You must have ImageMagick or GraphicsMagick installed
karmanyaahm commented 4 years ago

Thanks for the quick reply, That line in the config file made the first error go away, but as you said, ImageMagick is not installed. Is it in the scope of this action to add ImageMagick? If so, I would love to contribute to this action and make that happen.

karmanyaahm commented 4 years ago

I read over the code and it seems like it's possible to just add that to the docker image. It would be easier to always add ImageMagick but it would be more efficient to see if some extension needs it and then install it inside the docker image. Which would be your preferred way of doing it?

helaili commented 4 years ago

I'm afraid we cannot add every possible dependency to the Docker image, it would slow down each and every build. What about splitting the work, having one action processing the images whenever a new one is being pushed, and use the modified picture in the Jekyll site?

Having said that, after looking at your use case ({% picture "/assets/img/logo/computer_logo_transparent.png" --alt logo of a computer saying BHSCS --link / --img class="logoimg" %}), I'm not even sure about the value of this plugin in your context.

karmanyaahm commented 4 years ago

You're right about slowing down the build process and I'll try to find another action as a solution for that. This site is very alpha right now so that plugin isn't doing much just yet, but will be later on. Thanks for the help and maintaining this action.