Skip to content

Configuration

Adam Ormsby edited this page Oct 17, 2021 · 3 revisions

Input Variables (v2)

Core Use

Name Required? Default Example
hugo_publish_directory 'public' 'documents'
source_branch 'main'
release_branch 'release'
submodule_release_branch 'main'
  • release_branch - Maybe some of you don't want a separate release branch. You can always try using the same value as your source_branch. It might work? I haven't tried it.

  • submodule_release_branch - Only fill this input if your hugo_publish_directory contains a git submodule. If this input has a value, the submodule steps will run in the action. Leave it empty if you aren't publishing to a submodule. Those steps will be skipped.

Advanced Use

Name Default Example
hugo_build_options '-D --minify --ignoreCache'
merge_args '-s recursive -Xtheirs' '-X Ours'
full_rebuild 'false'
full_rebuild_verbose 'false'
do_not_delete_regex '\.txt|^posts$|static.css'
commit_message 'I like big builds, and I cannot lie.'
git_config_user 'Action - Hugo Deploy' 'aormsby'
git_config_email '[email protected]' '[email protected]'
strict_build_mode 'true'
tag_release 'false'
test_mode 'false'
  • full_rebuild - This will clean out the hugo_publish_directory before making a build. Hugo's build option --cleanDestinationDir deletes everything, but this action's full_rebuild is more specific. It will actually skip over the deletion of files that match the regex pattern you provide in do_not_delete_regex, so you don't lose important things like CNAME files, git configs, or other things that Hugo won't rebuild for you.

  • full_rebuild_verbose - Prints out saved/deleted files during the action run for reference

  • do_not_delete_regex - A custom regex pattern to match files you want to save during full_rebuild. Some files are hardcoded to be saved - "^\.+$|^\.git$|^CNAME$", which for sure includes ., .., .git, and CNAME. You can add your own regex patterns separated by | (the pipe character) as an input value here. Please be familiar with shell regex before adding your own. (Be careful with the . character!)

  • commit_message - A default auto-build message is provided as title and description, but you customize the commit title here

  • tag_release - If true, tagged with auto-build number (stored in hugo-deploy.dat build file)

  • strict_build_mode - If true, Hugo build warning will cause the action to fail. If false, only Hugo errors will cause failure.

Output Variables

Name Output Description
was_new_build_created true/false Outputs true if a new build was made, false if repo is up-to-date and build was skipped.

The syntax for checking outputs in workflows is very specific. If you have syntax problems, your output checks won't work as expected. Please note the different ways to access and compare output values in these samples--

    - name: Was a new build made?
      if: steps.build.outputs.was_new_build_created == 'true'
      run: echo "YAASSSS new build."
      if: steps.build.outputs.was_new_build_created == 'false'
      run: echo "NOOOOOOO new build."

New outputs can be added on request. Please open an issue describing your needs, and we can work out a good solution.

Input Change Table (v1 -> v2)

v1 v2
deploy_directory hugo_publish_directory
build_branch source_branch
X release_branch
deploy_branch submodule_release_branch
fresh_build full_rebuild
do_not_delete_files do_not_delete_regex
git_user git_config_user
git_email git_config_email

Setup Notes

Fetch Depth

The only major setup note I have right now is that you *must use fetch-depth:0 in your checkout step. I'm currently having trouble managing shallow repo clones within the action, and if you don't have a deep enough clone of the repo you will encounter unexpected problems in your build (such as earlier commits not being accounted for in the merge step to the release branch).

--

If you encounter any other setup problems or anything confusing, please open an issue and I can add more info here as needed. Thanks!