Giter Club home page Giter Club logo

jekyll-build-optional-deploy-gh-pages's Introduction

Configurable Github Action For Building and Optionally Deploying Jekyll Builds.

Goes to a configured directory, optionally destroys the Gemfile.lock, builds the jekyll site, and optionally goes to a configured directory to push to specified branch of the repo.

Really helpful if you just want to build your site and let another action in your workflow do something with it... like push to s3 maybe?

Options

Set these in the env of the github action. BUILD_DIR and REMOTE_BRANCH don't matter if DEPLOY_SITE is not true... obviously.

JEKYLL_ROOT Default:./ If your jekyll site isn't at the root if your repo, change this so that a cd command points to the jekyll root.

GEMFILE Default:Gemfile If you aren't using a default named Gemfile; change its name here.

REMOVE_GEMLOCK Default:true When true we'll rm Gemfile.lock before trying to build the jekyll site.

DELETE_BEFORE_BUILD Default:no default!... If set calls rm -rf <> before building the site... Useful for removing directories you don't want in your final site for whatever reason.

DEPLOY_SITE Default:true If we should try and build the site and deploy it the REMOTE_DIR.

BUILD_DIR Default:_site/ What directly will the site get built into. This is telling our deployment actions where to work, it does NOT change where your site gets built into, use your _config.yml for that.

REMOTE_BRANCH Default:gh-pages Which branch of the repo should we push our BUILD_DIR to?

Example

This would build and deploy the jekyll site contained within the MySite dir of the repo to the staging branch of the repo when ever the dev branch gets pushed to.

Change dev to master if and remove the JEKYLL_ROOT and REMOTE_BRANCH env settings if you want vanilla default actions to happen when master gets pushed.

The GITHUB_* env variables are populated by github actions, they must be defined but you don't need to set them yourself.

name: Jekyll Build - Optional Deploy

on:
  push:
    branches:
    - dev

jobs: 
  build_and_deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Building a jekyll site from configured directory, maybe deploying it.
        env: 
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          GITHUB_REPOSITORY: ${{ secrets.GITHUB_REPOSITORY }}
          GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}
          JEKYLL_ROOT: "MySite/"
          REMOTE_BRANCH: "staging"
        uses: agentd00nut/jekyll-build-optional-deploy-gh-pages@master

Multiple sites

This isn't tested but it should be possible within the same job. Just explicitly state all the env variables for each - name'd use of the action.

Gotchas

Changes pushed to your gh-pages branch will only be picked up by the Github Pages server if your workflow is in a private repository.

jekyll-build-optional-deploy-gh-pages's People

Contributors

agentd00nut avatar ileadall42 avatar psyreactor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.