tech-docs-template icon indicating copy to clipboard operation
tech-docs-template copied to clipboard

[Docs] Deploy via GitHub Workflow

Open alex-hedley opened this issue 3 years ago • 0 comments

I've created a simple GitHub Pages Workflow to deploy this template.

Update the config.rb (See Middleman Github Pages - Project Page Path Issues)

activate :relative_assets
set :relative_links, true

Create a deploy.yml file in the .github/workflows/ folder.

name: Deploy

on:
  workflow_dispatch:
  push:
    branches: [main]
    paths:
      - "source/**"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: write
  pages: write

jobs:
  build_and_deploy:
    name: Build & Deploy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        
      - name: Set up 💎 Ruby 3.2.0
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.2.0
#           bundler-cache: true
        
      - name: Install Dependencies
        run: |
          echo 'Installing bundles...'
          gem install bundler
          bundle install
          bundle list | grep "middleman ("
        
      - name: Build
        run: bundle exec middleman build
      
      - name: Deploy
        uses: peaceiris/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: build

Would it be worth adding this to the Documentation Site?

alex-hedley avatar Jan 30 '23 09:01 alex-hedley