GitHub Action for building and publishing Hugo-built site.
Inspired by BryanSchuetz/jekyll-deploy-gh-pages
GIT_DEPLOY_KEY
- Required your deploy key which has Write access
- Generate deploy key
ssh-keygen -t rsa -f hugo -q -N ""
- Then go to "Settings > Deploy Keys" of repository
- Add your public key within "Allow write access" option.
- Copy your private deploy key to
GIT_DEPLOY_KEY
secret in "Settings > Secrets"
-
HUGO_VERSION
: optional, default is 0.54.0 - check all versions here -
GITHUB_BRANCH
: optional, default is gh-pages -
GITHUB_REMOTE_REPOSITORY
: optional, default is GITHUB_REPOSITORY
push.yml (New syntax)
Deploy to gh-pages branch: (under same repo)
- Note: put the
CNAME
file within your domain name insidestatic
folder of compiling branch (master)
name: Deploy to GitHub Pages
on: push
jobs:
hugo-deploy-gh-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: hugo-deploy-gh-pages
uses: khanhicetea/gh-actions-hugo-deploy-gh-pages@master
env:
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
HUGO_VERSION: "0.53"
Deploy to Remote Branch:
name: Deploy to Remote Branch
on:
push:
branches:
- master
jobs:
hugo-deploy-gh-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: hugo-deploy-gh-pages
uses: khanhicetea/gh-actions-hugo-deploy-gh-pages@master
env:
GITHUB_REMOTE_REPOSITORY: <username>/<remote_repository_name>
GITHUB_BRANCH: <custom_branch>
GIT_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }}
HUGO_VERSION: "0.58.3"
Note: make sure to add GIT_DEPLOY_KEY
in secrets of mentioned GITHUB_REMOTE_REPOSITORY
main.workflow (Old syntax - deprecated)
workflow "Deploy to GitHub Pages" {
on = "push"
resolves = ["hugo-deploy-gh-pages"]
}
action "hugo-deploy-gh-pages" {
uses = "khanhicetea/gh-actions-hugo-deploy-gh-pages@master"
secrets = [
"GIT_DEPLOY_KEY"
]
env = {
HUGO_VERSION = "0.53"
GITHUB_BRANCH = "master"
}
}
- RPC Ping (Ping Search Engine) : https://github.com/khanhicetea/gh-actions-rpc-ping
Copyright (c) 2019
Licensed under the MIT License.