Skip to content

Commit

Permalink
Support to disable colored output
Browse files Browse the repository at this point in the history
  • Loading branch information
shenxianpeng committed Apr 21, 2024
1 parent 3fbcf7c commit ffa9f4b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ It will show SHA256, MD5, BLAKE2-256 values of files to be uploaded.
print-hash: true
```

### Disable colored output

You may want to disable colored output when `twine upload`.

```yml
with:
no-color: true
```

### Specifying a different username

The default username value is `__token__`. If you publish to a custom
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ inputs:
Use `print-hash` instead.
required: false
default: 'false'
no-color:
description: Disable colored output.
required: false
default: 'false'
branding:
color: yellow
icon: upload-cloud
Expand All @@ -95,3 +99,4 @@ runs:
- ${{ inputs.skip-existing }}
- ${{ inputs.verbose }}
- ${{ inputs.print-hash }}
- ${{ inputs.no-color }}
5 changes: 5 additions & 0 deletions twine-upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ INPUT_PACKAGES_DIR="$(get-normalized-input 'packages-dir')"
INPUT_VERIFY_METADATA="$(get-normalized-input 'verify-metadata')"
INPUT_SKIP_EXISTING="$(get-normalized-input 'skip-existing')"
INPUT_PRINT_HASH="$(get-normalized-input 'print-hash')"
INPUT_NO_COLOR="$(get-normalized-input 'no-color')"

PASSWORD_DEPRECATION_NUDGE="::error title=Password-based uploads deprecated::\
Starting in 2024, PyPI will require all users to enable Two-Factor \
Expand Down Expand Up @@ -133,6 +134,10 @@ if [[ ${INPUT_PRINT_HASH,,} != "false" || ${INPUT_VERBOSE,,} != "false" ]] ; the
python /app/print-hash.py ${INPUT_PACKAGES_DIR%%/}
fi

if [[ ${INPUT_NO_COLOR,,} != "false" ]] ; then
TWINE_EXTRA_ARGS="--no-color $TWINE_EXTRA_ARGS"
fi

TWINE_USERNAME="$INPUT_USER" \
TWINE_PASSWORD="$INPUT_PASSWORD" \
TWINE_REPOSITORY_URL="$INPUT_REPOSITORY_URL" \
Expand Down

0 comments on commit ffa9f4b

Please sign in to comment.