Skip to content

Commit

Permalink
Get user flag from env
Browse files Browse the repository at this point in the history
Update README.md and onboard pre-commit for linting
  • Loading branch information
dormant-user committed May 27, 2024
1 parent a75f361 commit a6b16f1
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 234 deletions.
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,34 @@ jobs:
- uses: thevickypedia/pypi-publisher@v3
env:
token: ${{ secrets.PYPI_TOKEN }}
with:
skip-existing: true
```
### Allowed Inputs
- `user` - PyPi username. Defaults to `__token__`
- `token` - PyPi token. **Mandatory**
- `test-upload` - Uploads to [TestPyPi repository][test-pypi]. Defaults to `false`
- `dry-run` - Builds the distribution without uploading to PyPi. Defaults to `false`
- `repository-url` - PyPi repository URL. Set based on `test-upload` flag.
- `packages-dir` - The target directory for distribution. Defaults to `dist`
- `verify-metadata` - Check metadata before uploading. Defaults to `true`
- `skip-existing` - Avoids failing if distribution exists in package index.
- `verbose` - Runs in verbose mode. Defaults to `false`
- `print-hash` - Show hash values of distribution files. Defaults to `true`
- `setup-python` - Uses the GH action `setup-python`. Defaults to `false`
but gets overridden dynamically based on `python` command's availability.
- `python-version` - Python version for `setup-python`. Defaults to `3.9`
| Parameter | Description | Default |
|-------------------|---------------------------------------------------------|---------------------|
| `user` | PyPi username. | `__token__` |
| `token` | PyPi token. **[Mandatory]** | **NA** |
| `test-upload` | Uploads to [TestPyPi][test-pypi] repository. | `false` |
| `dry-run` | Builds the distribution without uploading to PyPi. | `false` |
| `repository-url` | PyPi repository URL. | [upload.pypi.org]** |
| `packages-dir` | The target directory for distribution. | `dist` |
| `verify-metadata` | Check metadata before uploading. | `true` |
| `skip-existing` | Avoids failing if distribution exists in package index. | `true` |
| `verbose` | Runs in verbose mode. | `false` |
| `print-hash` | Show hash values of distribution files. | `true` |
| `setup-python` | Uses the GH action `setup-python`. | `false`** |
| `python-version` | Python version for `setup-python`. | `3.9` |

**Notes**

>- `repository-url` defaults to [upload.pypi.org], but it can change dynamically based on the `test-upload` flag.
>- `setup-python` defaults to `false`, but it can change dynamically based on whether `python` is installed in the runner.
>- `python-version` will be used only when `setup-python` flag is set to `true`, otherwise the default `python` in the runner takes precedence.

> Only `user` and `token` can be passed as `env` whilst, rest of the parameters should be passed using `with`

## License & copyright

Expand All @@ -60,4 +71,5 @@ Licensed under the [MIT License][license]
[pages]: https://thevickypedia.github.io/pypi-publisher/
[license]: https://github.com/thevickypedia/pypi-publish/blob/main/LICENSE
[test-pypi]: https://test.pypi.org
[upload.pypi.org]: https://upload.pypi.org/legacy/
[marketplace]: https://github.com/marketplace/actions/pypi-publisher
Loading

0 comments on commit a6b16f1

Please sign in to comment.