FYI: GitHub Actions - Middleman + Webpack

If you are setting up your site to run on GitHub Actions to deploy to GitHub Pages, here is my workflow.

name: Auto Deployment to Github Pages

on:
  pull_request:
    branches:
    - master

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@master
    # ----------------------------------------------------Ruby
    - name: Install Ruby
      uses: actions/setup-ruby@v1
      with:
        version: 2.6.x
    - name: Ruby Version
      run: |
        ruby -v
    - name: Setup Ruby Dependencies
      run: |
        gem update bundler
        bundle install --jobs 4 --retry 3
    - name: Test Ruby Dependencies
      run: |
        bundle exec rake -T
    # ----------------------------------------------------Node
    - name: Install Node
      uses: actions/setup-node@v1
      with:
        version: 10.16.3
    - name: Node Version
      run: |
        node --version
    - name: Setup Node Dependencies
      run: |
        npm install
    # ----------------------------------------------------Webpack
    - name: Build Webpack File
      run: |
        bundle exec rake webpack:build:production
    - name: Build Middle Site
      run: |
        export TERM=xterm
        bundle exec middleman build -e production --verbose
    # ----------------------------------------------------Deploy
    - name: Deploy to Github Pages
      uses: peaceiris/actions-gh-pages@v1.1.0
      if: success()
      env:
        GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
        PUBLISH_BRANCH: gh-pages
        PUBLISH_DIR: ./build
2 Likes