/hugo-deploy-gh-org-pages

Github Action to Automate Hugo for an Organization Github Page

Primary LanguageShellMIT LicenseMIT

hugo-deploy-gh-org-pages

Github Action to Automate Hugo extended for a Github Organization Pages

license release GitHub release date StevenACoffman/hugo-deploy-gh-org-pages latest version

GitHub Actions for building Hugo extended and deploying to a Github Organization Pages Submodule Repository

GitHub Action for building and publishing Hugo-built site to a Github Organization Pages. Follow the Hosting on Github Organization Pages step by step instructions.

This action goes in the repository that will contain Hugo’s content and other source files, and expects public to be a submodule pointing to a repo named like organization.github.io.

Inspired by khanhicetea/gh-actions-hugo-deploy-gh-pages

Secrets

  • EMAIL - The email that you would like to have your git push signed as.
  • DEPLOY_KEY_PRIVATE - Required your deploy key which has Write access

Create Deploy Key

  1. Generate deploy key ssh-keygen -t rsa -b 4096 -f hugo -q -N ""
  2. Then go to your repo named <orgname>.github.ioand select "Settings > Deploy Keys" and click the "Add New" button
  3. Add the contents of your public key (hugo.pub) to the Key field and select the "Allow write access" option.
  4. Go to the repo named like organization.github.io that will contain the fully rendered version of your Hugo website
  5. Add the github action as below (the file will go in .github/main.workflow)
  6. Copy your private deploy key to DEPLOY_KEY_PRIVATE secret in "Settings > Secrets"

Environment Variables

Example

Works both with the new yaml workflow format, or the old hcl format, but just use one.

.github/workflows/push.yml

on: push
name: Deploy to GitHub Organization Pages
jobs:
  filtersForGitHubActions:
    name: Filters for GitHub Actions
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - name: Filters for GitHub Actions
      uses: actions/bin/filter@master
      with:
        args: branch master
    - name: hugo-deploy-gh-org-pages
      uses: StevenACoffman/hugo-deploy-gh-org-pages@v1.0.3
      env:
        DEPLOY_KEY_PRIVATE: ${{ secrets.DEPLOY_KEY_PRIVATE }}
        EMAIL: ${{ secrets.EMAIL }}
        HUGO_VERSION: 0.56.3

main.workflow

workflow "Deploy to GitHub Organization Pages" {
  resolves = ["hugo-deploy-gh-org-pages"]
  on = "push"
}

action "hugo-deploy-gh-org-pages" {
  uses = "StevenACoffman/hugo-deploy-gh-org-pages@v1.0.3"
  needs = ["Filters for GitHub Actions"]
  secrets = [
    "EMAIL",
    "DEPLOY_KEY_PRIVATE"
  ]
  env = {
    HUGO_VERSION = "0.56.3"
  }
}

action "Filters for GitHub Actions" {
  uses = "actions/bin/filter@master"
  args = "branch master"
}

License

MIT License - StevenACoffman/hugo-deploy-gh-org-pages