helaili / jekyll-action

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

Unable to set timezone #36

Closed chauncyf closed 4 years ago

chauncyf commented 4 years ago

Hi there!

I specified "timezone: America/New_York" in the _config.yml, and it works well locally. But seems that the action will ignore the timezone and build the site based on UTC.

I also found out that, in the Jekyll doc, says that "When serving on a local machine, the default time zone is set by your operating system. But when served on a remote host/server, the default time zone depends on the server's setting or location." . I guess in order to fix this, we need to add a variable to specify TZ for Docker.

Please let me know if I missed something, thanks!

chauncyf commented 4 years ago

I tried to modify the Dockerfile and it works. https://github.com/gliderlabs/docker-alpine/issues/136#issuecomment-272703023

# Install base packages
RUN apk update
RUN apk upgrade
RUN apk add ca-certificates && update-ca-certificates
# Change TimeZone
RUN apk add --update tzdata
ENV TZ=America/New_York
# Clean APK cache
RUN rm -rf /var/cache/apk/*
helaili commented 4 years ago

I think you can simply set the timezone option in _config.yml.

chauncyf commented 4 years ago

I think you can simply set the timezone option in _config.yml.

I did, but that only works when it's running locally.

helaili commented 4 years ago

Can you share how you're leveraging the timezone so I can check this out?

chauncyf commented 4 years ago

Can you share how you're leveraging the timezone so I can check this out?

Of course

In the _config.yml, I have:

timezone: America/New_York

And in the permalink of each post, I have a data field with an offset like this:

date: 2020-05-21 20:10 -0400

This configuration works well locally and works well with Github Pages's own build (i.e. without Github Actions)

helaili commented 4 years ago

Can you try to run the same workflow but pointing at helaili/jekyll-action@8061d41 ?

chauncyf commented 4 years ago

Can you try to run the same workflow but pointing at helaili/jekyll-action@8061d41 ?

Thank you! Now it's working correctly.