edricchan03 / action-build-deploy-ghpages Goto Github PK
View Code? Open in Web Editor NEWGitHub Action to build and deploy a Jekyll site to GitHub Pages.
License: MIT License
GitHub Action to build and deploy a Jekyll site to GitHub Pages.
License: MIT License
Hi,
thank you for offering this very useful action!
The action builds the Jekyll site in the (default) development
environment. More details about environments here: https://jekyllrb.com/docs/configuration/environments/
The type of environment the site is built on does often matter. For example, both Minima and Minimal Mistakes only turn on comments in the posts if they are built in the production
environment. Minimal Mistakes also turns off analytics for development
environments.
This is not a bug, rather something that tripped me up and cost me a bit of time to figure out, so I thought I'd bring it to your attention!
A simple solution is to add an environment variable, like
steps:
- uses: actions/checkout@v2
- uses: EdricChan03/[email protected]
env:
JEKYLL_ENV: 'production'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
I think this example could be added as part of the documentation, together with a few examples of why this might matter. (You could also think about making the production
environment the default, which might be closer to what people need when deploying their site, but that might break some existing workflows.)
A blog post was recently posted in the GitHub Changelog regarding (beta) support for custom GitHub Actions workflows directly in the repository, without having to rely upon external GitHub Actions such as this very action.
An example workflow is as shown below (source):
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
on:
# Runs on pushes targeting the default branch
push:
branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
This effectively means that there's no longer a need for such a custom GitHub Action, unless additional configuration is needed.
However, additional in-depth research is needed, such as the inputs that the actions/jekyll-build-actions GitHub Action supports, and whether they're sufficient enough for regular usage.
Happens on v2.6.0 for mac os build
Hello!
I've setup a basic github actions system with your action, however it throws some exceptions:
name: Deploy Jekyll Website
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Source checkout
uses: actions/checkout@master
- name: Build and deploy jekyll website
uses: EdricChan03/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
gh_pages_token: ${{ secrets.GH_PAGES_TOKEN }}
OVERRIDE_GH_PAGES_BRANCH: ${{ true }}
Run EdricChan03/[email protected]
/usr/bin/docker run --name bb81dd60631ac2e14781a983cf095e48fef9_8b1c5f --label 04bb81 --workdir /github/workspace --rm -e INPUT_GITHUB_TOKEN -e INPUT_GH_PAGES_TOKEN -e INPUT_OVERRIDE_GH_PAGES_BRANCH -e INPUT_GH_PAGES_BRANCH -e INPUT_GH_PAGES_DIST_FOLDER -e INPUT_GH_PAGES_COMMIT_MESSAGE -e INPUT_REMOTE_REPO -e INPUT_COMMITTER_USERNAME -e INPUT_COMMITTER_EMAIL -e INPUT_GIT_FORCE -e INPUT_GH_PAGES_ADD_NO_JEKYLL -e HOME -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -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/lyze237.github.io/lyze237.github.io":"/github/workspace" 04bb81:dd60631ac2e14781a983cf095e48fef9
/entrypoint.sh: line 33: INPUT_GH_PAGES_COMMIT_MESSAGE: Deploy commit using EdricChan03action-build-deploy-ghpages in Deploy Jekyll Website: syntax error in expression (error token is "commit using EdricChan03action-build-deploy-ghpages in Deploy Jekyll Website")
Installing gem bundle...
/entrypoint.sh: line 40: INPUT_REMOTE_REPO: https://x-access-token:***@github.com/lyze237/lyze237.github.io.git: syntax error in expression (error token is "://x-access-token:***@github.com/lyze237/lyze237.github.io.git")
/entrypoint.sh: line 46: INPUT_COMMITTER_EMAIL: [email protected]: syntax error: invalid arithmetic operator (error token is "@users.noreply.github.com")
##[error]Docker run failed with exit code 1
I'm not really great with bash but I think you're missing a -
after :
in most lines. (I've forked the project and trying out things)
Issue templates would help triage new issues, and enforce a specific issue style
This issue will be used as an update on the status of using the GITHUB_TOKEN
on deploying.
Hello ๐, I received the following errors when running the workflow with your actions:
##[error]/home/runner/work/_actions/EdricChan03/action-build-deploy-ghpages/v2.0.0/action.yml (Line: 27, Col: 14): A template expression is not allowed in this context
##[error]/home/runner/work/_actions/EdricChan03/action-build-deploy-ghpages/v2.0.0/action.yml (Line: 30, Col: 14): A template expression is not allowed in this context
##[error]/home/runner/work/_actions/EdricChan03/action-build-deploy-ghpages/v2.0.0/action.yml (Line: 33, Col: 14): A template expression is not allowed in this context
##[error]/home/runner/work/_actions/EdricChan03/action-build-deploy-ghpages/v2.0.0/action.yml (Line: 27, Col: 14): A template expression is not allowed in this context
##[error]/home/runner/work/_actions/EdricChan03/action-build-deploy-ghpages/v2.0.0/action.yml (Line: 30, Col: 14): A template expression is not allowed in this context
##[error]/home/runner/work/_actions/EdricChan03/action-build-deploy-ghpages/v2.0.0/action.yml (Line: 33, Col: 14): A template expression is not allowed in this context
##[error]Unexpected type 'BasicExpressionToken' encountered while reading 'input default'. The type 'StringToken' was expected.
##[error]Fail to load /home/runner/work/_actions/EdricChan03/action-build-deploy-ghpages/v2.0.0/action.yml
I'm not sure what this error is about, is it YAML error?
You can see this workflow error here in our repository: https://github.com/id-ruby/id-ruby/commit/76bd6d205164c96c9034dff5231774860d752066/checks
I get the following error message when attempting to run the action:
/entrypoint.sh: line 33: INPUT_GH_PAGES_COMMIT_MESSAGE: Deploy commit using EdricChan03action-build-deploy-ghpages in Build GH Pages: syntax error in expression (error token is "commit using EdricChan03action-build-deploy-ghpages in Build GH Pages")
ERROR: Please use the GH_PAGES_TOKEN to specify the token to use for triggering a build request.
##[error]Docker run failed with exit code 1
This is the contents of my build-pages.yml
file:
name: Build GH Pages
on: [push]
jobs:
build:
name: Build and deploy GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: EdricChan03/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
gh_pages_token: ${{ secrets.GH_PAGES_TOKEN }}
And I have the GH_PAGES_TOKEN added as a secret on the repo.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.