After creating a new project using Hugo's Quick Start guide, you can then deploy to GitHub Pages.
###Git Branches
For this site, we are deploying the project hosted at napjoseph/napjoseph.github.io.
Since this is an Organization Pages-type repository, we will be using following branches for our workflow:
$ git branchmaster # the branch that GitHub pages will serve the files fromstable # the main development branch where all pull requests will be merged toid_your_feature # additional development branches for new features
###Add your Deploy Key
Follow the tutorial over at peaceiris/actions-gh-pages and add an SSH deploy key for your project.
###Create your GitHub Action
Afterwards, create a directory for your workflows and add the config file for your new action.
$ mkdir -p .github/workflows$ touch .github/workflows/deploy.yml
.github/workflows/deploy.yml
1name: deploy-to-master23on:4 push:5 branches:6 - stable78jobs:9 build-and-deploy:10 runs-on: ubuntu-latest11 steps:12 - name: Checkout13 uses: actions/checkout@v214 with:15 persist-credentials: false1617 - name: Update theme18 run: git submodule update --init --recursive1920 - name: Setup Hugo21 uses: peaceiris/actions-hugo@v222 with:23 hugo-version: '0.74.3'2425 - name: Build26 run: HUGO_ENV=production hugo --minify2728 - name: Deploy29 uses: peaceiris/actions-gh-pages@v330 with:31 deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}32 publish_dir: ./public33 publish_branch: master34 keep_files: false35 allow_empty_commit: true
###Deployment
After merging your pull requests to the stable
branch, it should automatically
deploy to the master
branch.