Skip to content

Commit

Permalink
Adding possibility of debug and extra flags to deploy command
Browse files Browse the repository at this point in the history
  • Loading branch information
mkukawski authored and jsmrcaga committed Apr 13, 2024
1 parent 9061c0e commit 68f5995
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ inputs:
description: A deploy message
required: false
default: ""
debug:
description: When provided, prints more debug info in NETLIFY_OUTPUT
required: false
default: ""
build_directory:
description: Directory where built files are stored
required: true
Expand All @@ -43,6 +47,10 @@ inputs:
description: In monorepos, package to deploy
required: false
default: ""
command_extra_flags:
description: Any optional extra flags added to Netlify deploy command
required: false
default: ""
outputs:
NETLIFY_OUTPUT:
description: netlify command output
Expand All @@ -68,6 +76,8 @@ runs:
BUILD_COMMAND: ${{ inputs.build_command }}
DEPLOY_ALIAS: ${{ inputs.deploy_alias }}
MONOREPO_PACKAGE: ${{ inputs.monorepo_package }}
DEBUG: ${{ inputs.debug }}
COMMAND_EXTRA_FLAGS: ${{ inputs.command_extra_flags }}

branding:
icon: activity
Expand Down
11 changes: 11 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fi
export NETLIFY_SITE_ID="${NETLIFY_SITE_ID}"
export NETLIFY_AUTH_TOKEN="${NETLIFY_AUTH_TOKEN}"

# command based on https://cli.netlify.com/commands/deploy
COMMAND="netlify deploy --dir=${BUILD_DIRECTORY} --functions=${FUNCTIONS_DIRECTORY} --message=\"${NETLIFY_DEPLOY_MESSAGE}\""

if [[ "${NETLIFY_DEPLOY_TO_PROD}" == "true" ]]
Expand All @@ -40,6 +41,16 @@ then
COMMAND+=" --filter ${MONOREPO_PACKAGE}"
fi

if [[ -n "${DEBUG}" ]]
then
COMMAND+=" --debug "
fi

if [[ -n "${COMMAND_EXTRA_FLAGS}" ]]
then
COMMAND+=" ${COMMAND_EXTRA_FLAGS} "
fi

OUTPUT=$(sh -c "$COMMAND")

# Set outputs
Expand Down

0 comments on commit 68f5995

Please sign in to comment.