Skip to content

Commit 068c3b0

Browse files
committed
Add instructions to README and example.
1 parent 4da86aa commit 068c3b0

File tree

2 files changed

+96
-1
lines changed

2 files changed

+96
-1
lines changed

EXAMPLE.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# This file must be in your GitHub repository workflows dir.
2+
# e.g. .github/workflows/release.yml
3+
4+
name: Upload to PyPI
5+
6+
# This action will be triggered when you create a new GitHub tag
7+
on:
8+
release:
9+
types: [created]
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: pypi-github-sync
16+
uses: PabloLec/[email protected]
17+
with:
18+
github_repo: PabloLec/recoverpy # Change these values
19+
twine_username: ${{ secrets.TWINE_USERNAME }}
20+
twine_password: ${{ secrets.TWINE_PASSWORD }}
21+
verify_metadata: true
22+
skip_existing: true
23+
verbose: true

README.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,73 @@
1-
# pypi-github-sync
1+
# pypi-github-sync [![GitHub release (latest by date)](https://img.shields.io/github/v/release/pablolec/pypi-github-sync)](https://github.com/PabloLec/pypi-github-sync/releases/) [![GitHub](https://img.shields.io/github/license/pablolec/pypi-github-sync)](https://github.com/PabloLec/pypi-github-sync/blob/main/LICENCE)
2+
3+
This action allows you to upload your Python distribution package to PyPI automatically using latest GitHub version tag as release version.
4+
5+
## How does it work?
6+
7+
Running a Docker container, this action will clone your repo, fetch its latest release tag, modify `setup.py`, build and finally push to PyPI.
8+
9+
It currently only support `setup.py`, see [Contributing](#Contributing) if you want other supported formats.
10+
11+
Also, with current procedure your GitHub repo remains untouched. That means the version parameter in `setup.py` will not be modified and its value does not matter.
12+
You can leave a dummy value, for example:
13+
``` Python
14+
setup(
15+
version="0.0.0",
16+
...
17+
)
18+
```
19+
20+
21+
## Usage
22+
23+
In your GitHub repo, create a workflow file or append to an existing one. (e.g. `.github/workflows/release.yml`)
24+
25+
Mandatory parameters are:
26+
``` yaml
27+
- name: pypi-github-sync
28+
uses: PabloLec/[email protected]
29+
with:
30+
github_repo: YOUR_USERNAME/YOUR_REPO
31+
twine_username: ${{ secrets.TWINE_USERNAME }}
32+
twine_password: ${{ secrets.TWINE_PASSWORD }}
33+
```
34+
35+
You will need to change `YOUR_USERNAME` and `YOUR_REPO` values and set your PyPI username and password in your repository secrets ([See the docs for reference](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository)).
36+
37+
See [EXAMPLE.yml](EXAMPLE.yml) for a real world example.
38+
39+
## Inputs
40+
41+
#### `github_repo` *mandatory*
42+
43+
Your github repository with format `USERNAME/REPO` as in URLs. For example this repo is `PabloLec/pypi-github-sync`.
44+
45+
#### `twine_username` *mandatory*
46+
47+
Your PyPI username, add it to your [repository secrets](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository).
48+
49+
#### `twine_password` *mandatory*
50+
51+
Your PyPI password, add it to your [repository secrets](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository).
52+
53+
#### `upload_repo` *optional*
54+
55+
The repository used for package uploading. Defaults to main PyPI repo, you can use others like PyPI test repo with `'https://test.pypi.org/legacy/'`.
56+
57+
#### `verify_metadata` *optional*
58+
59+
Verify build metadata before publication, defaults to false.
60+
61+
#### `skip_existing` *optional*
62+
63+
Do not raise an error if version already exists on repo, defaults to false.
64+
65+
#### `verbose` *optional*
66+
67+
Verbose output for twine upload, defaults to false.
68+
69+
## Contributing
70+
71+
Any contribution is welcome.
72+
To report a bug or offer your help, simply open a new [issue](issues).
73+
You can also open an issue if you want a new feature to be implemented.

0 commit comments

Comments
 (0)