GithubHelp home page GithubHelp logo

daskycodes / bridgetown-gh-pages-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from andrewmcodes/bridgetown-gh-pages-action

0.0 0.0 0.0 221 KB

A GitHub Action for building and deploying a Bridgetown site to GitHub Pages

Home Page: https://andrewmcodes.github.io/bridgetown-gh-pages-starter/

License: MIT License

Dockerfile 28.88% Shell 71.12%

bridgetown-gh-pages-action's Introduction

Banner

bridgetown-gh-pages-action

A GitHub Action for building and deploying a Bridgetown site to GitHub Pages.

Getting Started

This is intended to be an out-of-the-box solution for deploying your Bridgetown to GitHub Pages.

- name: Build & Deploy to GitHub Pages
  uses: andrewmcodes/[email protected]
  with:
    github_token: ${{ secrets.GITHUB_TOKEN }}

๐Ÿšจ IMPORTANT Due to the way GitHub Actions work, you cannot pass in a Ruby version to the Docker container that gets built (or at least I can't find a way). Due to this, this action will build your site with Ruby 2.7.1. If you cannot upgrade your Ruby version for some reason, I suggest forking this action and adding the Ruby version you need in the Dockerfile, or using a manual solution.

Usage

Basic

name: Deploy

on:
  push:
    branches: [main]

jobs:
  build_and_deploy:
    name: Build & Deploy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build & Deploy to GitHub Pages
        uses: andrewmcodes/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}

Advanced

name: Deploy

on:
  push:
    branches: [main]

jobs:
  build_and_deploy:
    name: Build & Deploy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Build & Deploy to GitHub Pages
        uses: andrewmcodes/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          repository: andrewmcodes/bridgetown-gh-pages-action
          github_actor: octokit
          site_location: "./site"
          build_location: "./site/output"
          deploy_branch: "deploy"
          commit_message: "Release the site"

Inputs

Name Type Required? Default Description
github_token String true Token for the repo. Can be passed in using ${{ secrets.GITHUB_TOKEN }}.
repository String false ${{ github.repository }} The GitHub repository to push the built site to.
github_actor String false ${{ github.actor }} Name of the deploy actor.
site_location String false . Location of the Bridgetown project within your repo.
build_location String false ./output Location of your Bridgetown generated site.
default_branch String false main The name of your default branch.
deploy_branch String false gh-pages Branch name to push the site to.
commit_message String false chore: deploy site The commit message that will be used when deploying.

Manual Solution

If you cannot use this action due to version constraints or other issues, you can do this manually with something like:

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  deploy:
    name: Deploy to GitHub Pages
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - name: Setup Node
        uses: actions/setup-node@v1
        with:
          node-version: "13.x"
      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"
      - uses: actions/cache@v1
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-
      - name: Set up Ruby 2.7
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.7.1
      - name: Cache gems
        uses: actions/cache@v1
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-
      - name: Install Dependencies
        run: |
          bundle config path vendor/bundle
          bundle install --jobs 4 --retry 3
          yarn install
      - name: Build site for deployment
        run: yarn deploy
      - name: Deploy to GitHub Pages
        if: success()
        uses: crazy-max/ghaction-github-pages@v2
        with:
          target_branch: gh-pages
          build_dir: output
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Demo

bridgetown-gh-pages-starter

This starter can be used to reproduce issues as well as provide an example of the plugin's usage.

You can view the live version at: andrewmcodes.github.io/bridgetown-gh-pages-starter.

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

License

This plugin is released under the MIT License.

bridgetown-gh-pages-action's People

Contributors

andrewmcodes 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.