Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khanhicetea/gh-actions-hugo-deploy-gh-pages
Github Actions : Hugo static site generator
https://github.com/khanhicetea/gh-actions-hugo-deploy-gh-pages
deployment docker github-actions hugo
Last synced: 9 days ago
JSON representation
Github Actions : Hugo static site generator
- Host: GitHub
- URL: https://github.com/khanhicetea/gh-actions-hugo-deploy-gh-pages
- Owner: khanhicetea
- Created: 2019-01-17T04:53:47.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-13T09:39:32.000Z (almost 5 years ago)
- Last Synced: 2024-08-01T16:35:49.273Z (3 months ago)
- Topics: deployment, docker, github-actions, hugo
- Language: Shell
- Size: 43 KB
- Stars: 42
- Watchers: 3
- Forks: 13
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-actions - Build Hugo static content site and publish it to gh-pages branch
- fucking-awesome-actions - Build Hugo static content site and publish it to gh-pages branch
- awesome-workflows - Build Hugo static content site and publish it to gh-pages branch
README
# Hugo Github Action
GitHub Action for building and publishing Hugo-built site.
Inspired by [BryanSchuetz/jekyll-deploy-gh-pages](https://github.com/BryanSchuetz/jekyll-deploy-gh-pages)
## Secrets
- `GIT_DEPLOY_KEY` - *Required* your deploy key which has **Write access**
## Create Deploy Key
1. Generate deploy key `ssh-keygen -t rsa -f hugo -q -N ""`
1. Then go to "Settings > Deploy Keys" of repository
1. Add your public key within "Allow write access" option.
1. Copy your private deploy key to `GIT_DEPLOY_KEY` secret in "Settings > Secrets"## Environment Variables
- `HUGO_VERSION` : **optional**, default is **0.54.0** - [check all versions here](https://github.com/gohugoio/hugo/releases)
- `GITHUB_BRANCH` : **optional**, default is **gh-pages**
- `GITHUB_REMOTE_REPOSITORY` : **optional**, default is **GITHUB_REPOSITORY**
## Example
**push.yml** (New syntax)
**Deploy to gh-pages branch**: (under same repo)
- Note: put the `CNAME` file within your domain name inside `static` folder of compiling branch (master)
```yaml
name: Deploy to GitHub Pageson: 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**:
```yaml
name: Deploy to Remote Branchon:
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: /
GITHUB_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)
```hcl
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"
}
}
```## Other actions
- RPC Ping (Ping Search Engine) : https://github.com/khanhicetea/gh-actions-rpc-ping
## LICENSE
Copyright (c) 2019
Licensed under the MIT License.