Skip to content

Commit 444ab72

Browse files
committed
Added simple support for pyproject.toml
1 parent bbb4409 commit 444ab72

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

Diff for: EXAMPLE.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: pypi-github-sync
16-
uses: PabloLec/[email protected].0
16+
uses: PabloLec/[email protected].1
1717
with:
1818
github_repo: PabloLec/recoverpy # Change these values
1919
twine_username: ${{ secrets.TWINE_USERNAME }}

Diff for: README.md

+3-5
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@ This action allows you to upload your Python package to PyPI automatically using
44

55
## How does it work?
66

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.
7+
Running a Docker container, this action will clone your repo, fetch its latest release tag, modify `setup.py` and/or `pyproject.toml`, build and finally push to PyPI.
88

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.
9+
Also, with current procedure your GitHub repo remains untouched. That means the version parameter in your setup file will not be modified and its value does not matter.
1210
You can leave a dummy value, for example:
1311
``` Python
1412
setup(
@@ -25,7 +23,7 @@ In your GitHub repo, create a workflow file or append to an existing one. (e.g.
2523
Mandatory parameters are:
2624
``` yaml
2725
- name: pypi-github-sync
28-
uses: PabloLec/[email protected].0
26+
uses: PabloLec/[email protected].1
2927
with:
3028
github_repo: YOUR_USERNAME/YOUR_REPO
3129
twine_username: ${{ secrets.TWINE_USERNAME }}

Diff for: entrypoint.sh

+11-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,18 @@ echo "Cleaned version name: ${CLEAN_VER}"
3333

3434
VERSION_REGEX='version=\"[^"]\+\"'
3535
VERSION_REPLACE="version=\"${CLEAN_VER}\""
36+
VERSION_REGEX_WITH_SPACE='version\ =\ \"[^"]\+\"'
37+
VERSION_REPLACE_WITH_SPACE="version\ =\ \"${CLEAN_VER}\""
3638

37-
sed -i -e "s/${VERSION_REGEX}/${VERSION_REPLACE}/g" setup.py
39+
if [[ -e setup.py ]]; then
40+
sed -i -e "s/${VERSION_REGEX}/${VERSION_REPLACE}/g" setup.py
41+
sed -i -e "s/${VERSION_REGEX_WITH_SPACE}/${VERSION_REPLACE_WITH_SPACE}/g" setup.py
42+
fi
43+
44+
if [[ -e pyproject.toml ]]; then
45+
sed -i -e "s/${VERSION_REGEX}/${VERSION_REPLACE}/g" pyproject.toml
46+
sed -i -e "s/${VERSION_REGEX_WITH_SPACE}/${VERSION_REPLACE_WITH_SPACE}/g" pyproject.toml
47+
fi
3848

3949
echo "---------------- BUILD PACKAGE ----------------"
4050

0 commit comments

Comments
 (0)