A GitHub Action for building and deploying your Jekyll site via SSH.
- Create a GitHub workflow file (e.g.
.github/workflows/SSH-deploy-action.yml
) as per [here.](https://github.com/YakGalaxy/jekyll-SSH-deploy-action/blob/main/SSH-deploy-action.yml - Ensure your source and target values are correct within your new
SSH-deploy-action.yml
file. - Create your
HOST
,USERNAME
andPASSWORD
secrets within your repository on Github.com(your-repository/settings/secrets/actions)
. - Push your
SSH-deploy-action.yml
file to your repository'smain
branch.
name: Build and Deploy Jekyll via SSH
description: 💾 A Github Action to build and then deploy your Jekyll site via SSH
on:
workflow_dispatch: # Allows workflow to be run manually
push:
branches:
- main # Or your default branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 💎 Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2.3' # Adjust as needed for your project
- name: 🏗️ Build Jekyll site
run: |
bundle install
bundle exec jekyll build
- name: 🚀 Deploy via SSH
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }}
source: "./_site/*" # Adjust if required
target: "/public_html" # Set to your deployment directory (for example /public_html)
strip_components: 1 # This ensures that a subdirectory is not created
- Jekyll - A blog-aware static site generator in Ruby.
- actions/checkout - Action for checking out a repo.
- SCP for GitHub Actions - Action for copying files and artefacts via SSH.
Issues and Pull Requests are welcomed!
This software is licensed under the MIT license.