From 8468973d1d1d58464540a455e06a76ed3ca1ace3 Mon Sep 17 00:00:00 2001 From: "Adam.S" Date: Thu, 16 Jul 2020 09:51:08 +0900 Subject: [PATCH 1/7] First Attempt at passing arguments. Not pretty. Just testing to see if this will work. --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 3747bf2..2525011 100755 --- a/action.sh +++ b/action.sh @@ -24,7 +24,7 @@ if [ -d "${DEST}" ]; then fi echo '🍳 Build site' -hugo -d ${DEST} +hugo ${HUGO_ARGS} -d ${DEST} echo '🎁 Publish to remote repository' cd ${DEST} From 95cd5aa7e5e3153237f5883b1182d39bbfee7040 Mon Sep 17 00:00:00 2001 From: "Adam.S" Date: Fri, 17 Jul 2020 13:55:07 +0900 Subject: [PATCH 2/7] Added Hugo env argument This allows will allow a user to pass arguments to the hugo command. Options could include --minify, -D, -F --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 51aa600..7f8f4ee 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,8 @@ jobs: with: fetch-depth: 1 - name: 🚀 Build and deploy + env: + HUGO_ARGS: '--minify' # Add your Hugo arguments here. uses: victoriadrake/hugo-remote@master ``` From c3913a79d8b3eb39aeff8e1292e5de1bef87fb78 Mon Sep 17 00:00:00 2001 From: "Adam.S" Date: Fri, 17 Jul 2020 17:07:24 +0900 Subject: [PATCH 3/7] WIP: Added instructions for HUGO_ARGS I have added some instructions to avoid confusion on how to use HUGO_ARGS: I still need to test what happens if there is an empty string. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f8f4ee..fd3c102 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,14 @@ This action expects variables for: - `DEST`, the name of the destination directory you would like the site to build to, - `TOKEN`, in the form `${{ secrets.TOKEN }}` assuming `TOKEN` is the name you've used. +You can optionally set a string value for the variable named `HUGO_ARGS`. Note these should be set on a single line. + +- `HUGO_ARGS` in the form 'string' Here are some examples: +- `HUGO_ARGS: '--minify'` +- `HUGO_ARGS: '-D -F'` + +If you do not wish to pass any arguments. Please leave HUGO_ARGS blank as `HUGO_ARGS:` + Here is an example workflow file that uses this action on any `push` event to the `master` branch: ```yml @@ -55,7 +63,7 @@ jobs: fetch-depth: 1 - name: 🚀 Build and deploy env: - HUGO_ARGS: '--minify' # Add your Hugo arguments here. + HUGO_ARGS: uses: victoriadrake/hugo-remote@master ``` From ce422421b9943a9bbe562cb46ddd93bbcaefd99e Mon Sep 17 00:00:00 2001 From: "Adam.S" Date: Fri, 17 Jul 2020 17:22:44 +0900 Subject: [PATCH 4/7] Testing :-"" appended to HUGO_ARGS --- action.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.sh b/action.sh index 2525011..8c0d6ae 100755 --- a/action.sh +++ b/action.sh @@ -24,7 +24,7 @@ if [ -d "${DEST}" ]; then fi echo '🍳 Build site' -hugo ${HUGO_ARGS} -d ${DEST} +hugo ${HUGO_ARGS:-""} -d ${DEST} echo '🎁 Publish to remote repository' cd ${DEST} From 37fe419b2e0aa60bc8d4fcd9e7c06c64e735dcda Mon Sep 17 00:00:00 2001 From: "Adam.S" Date: Fri, 17 Jul 2020 17:31:24 +0900 Subject: [PATCH 5/7] Added ${HUGO_ARGS} This more for completeness. --- hugo-remote.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugo-remote.yml b/hugo-remote.yml index a9e06f5..458b7a7 100644 --- a/hugo-remote.yml +++ b/hugo-remote.yml @@ -43,7 +43,7 @@ jobs: rm -rf ${DEST}/* fi - name: 🍳 Build site - run: hugo -d ${DEST} + run: hugo ${HUGO_ARGS}-d ${DEST} - name: 🎁 Publish to remote repository env: TOKEN: ${{ secrets.TOKEN }} From 225fd3fe3f290fbfac91dc920c75aefbe99d2053 Mon Sep 17 00:00:00 2001 From: "Adam.S" Date: Sat, 18 Jul 2020 22:26:48 +0900 Subject: [PATCH 6/7] Update README.md Updated guide on passing arguments to HUGO_ARGS. --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fd3c102..cb390eb 100644 --- a/README.md +++ b/README.md @@ -28,14 +28,12 @@ This action expects variables for: - `DEST`, the name of the destination directory you would like the site to build to, - `TOKEN`, in the form `${{ secrets.TOKEN }}` assuming `TOKEN` is the name you've used. -You can optionally set a string value for the variable named `HUGO_ARGS`. Note these should be set on a single line. +You can optionally set an environment variable under 'Build and Deply'. `HUGO_ARGS`. -- `HUGO_ARGS` in the form 'string' Here are some examples: +Example Arugments. See `man hugo` on your system for more options: - `HUGO_ARGS: '--minify'` - `HUGO_ARGS: '-D -F'` -If you do not wish to pass any arguments. Please leave HUGO_ARGS blank as `HUGO_ARGS:` - Here is an example workflow file that uses this action on any `push` event to the `master` branch: ```yml @@ -62,8 +60,8 @@ jobs: with: fetch-depth: 1 - name: 🚀 Build and deploy - env: - HUGO_ARGS: + #env: + # HUGO_ARGS: uses: victoriadrake/hugo-remote@master ``` From df6fbd6fb41df3e9200b73d23bec6e4d230ca85e Mon Sep 17 00:00:00 2001 From: Victoria Drake Date: Sun, 19 Jul 2020 09:12:01 -0400 Subject: [PATCH 7/7] Minor edits and update contributors Co-authored-by: Patrik Ragnarsson --- README.md | 9 +++++---- hugo-remote.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index cb390eb..83caa8a 100644 --- a/README.md +++ b/README.md @@ -28,12 +28,13 @@ This action expects variables for: - `DEST`, the name of the destination directory you would like the site to build to, - `TOKEN`, in the form `${{ secrets.TOKEN }}` assuming `TOKEN` is the name you've used. -You can optionally set an environment variable under 'Build and Deply'. `HUGO_ARGS`. +See `env` in the below example for how to set these in your workflow YAML file. + +You can optionally set an environment variable `HUGO_ARGS` under the "Build and deploy" step. This allows passing one or more arbitrary [options](https://gohugo.io/commands/hugo/#options) to the `hugo` build command. See `man hugo` on your system for options. Some examples include: -Example Arugments. See `man hugo` on your system for more options: - `HUGO_ARGS: '--minify'` -- `HUGO_ARGS: '-D -F'` - +- `HUGO_ARGS: '--enableGitInfo --ignoreCache'` + Here is an example workflow file that uses this action on any `push` event to the `master` branch: ```yml diff --git a/hugo-remote.yml b/hugo-remote.yml index 458b7a7..193a7fb 100644 --- a/hugo-remote.yml +++ b/hugo-remote.yml @@ -43,7 +43,7 @@ jobs: rm -rf ${DEST}/* fi - name: 🍳 Build site - run: hugo ${HUGO_ARGS}-d ${DEST} + run: hugo ${HUGO_ARGS:-""} -d ${DEST} - name: 🎁 Publish to remote repository env: TOKEN: ${{ secrets.TOKEN }}