Skip to content

Commit

Permalink
Merge pull request #13 from JRubics/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
JRubics authored Oct 18, 2021
2 parents 903be54 + 0162867 commit e22da00
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ RUN apt-get update \
libssl-dev \
llvm \
make \
python-openssl \
openssl \
tk-dev \
wget \
xz-utils \
Expand Down
46 changes: 37 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ The version of poetry to install (default: latest).

**Required** API token to authenticate when uploading package to PyPI (You can find your token [here](https://pypi.org/manage/account/)).

### `build_format`

By default, poetry's build command outputs two formats: **wheel** and **sdist**. If you intend to use
only one of them, you may specify that with the `build_format` parameter.

### `repository_name`

The name of a repository where the package will be uploaded. Necessary if you'd like to upload to test PyPi or a private wheels repo. Uploads to official PyPi if not informed.
Expand All @@ -29,6 +24,19 @@ The name of a repository where the package will be uploaded. Necessary if you'd

The URL where the package will be uploaded. Necessary if you'd like to upload to test PyPi or a private wheels repo. Uploads to official PyPi if not informed.

### `repository_username`

The Username to log in into a repository where the package will be uploaded if using http-basic authentification instead of api token.

### `repository_password`

The Password to log in into a repository where the package will be uploaded if using http-basic authentification instead of api token.

### `build_format`

By default, poetry's build command outputs two formats: **wheel** and **sdist**. If you intend to use
only one of them, you may specify that with the `build_format` parameter.

### `ignore_dev_requirements`

This will instruct poetry **not** to install any developer requirements. this may lead to an overall quicker experience.
Expand All @@ -39,7 +47,7 @@ Allow poetry pre-release versions to be installed.

## Example usage

The following will build and publish the python package using the last version of python and poetry. Specify the python package version and dependencies in `pyproject.toml` in the root directory of your project.
The following will build and publish the python package to the PyPI using the last version of python and poetry. Specify the python package version and dependencies in `pyproject.toml` in the root directory of your project.

```yaml
- name: Build and publish to pypi
Expand All @@ -48,8 +56,7 @@ The following will build and publish the python package using the last version o
pypi_token: ${{ secrets.PYPI_TOKEN }}
```
Python and poetry versions can be specified in inputs as well as the build format and the repository
to publish to.
Python and poetry versions can be specified in inputs as well as the build_format, allow_poetry_pre_release and ignore_dev_requirements.
```yaml
- name: Build and publish to pypi
Expand All @@ -59,11 +66,32 @@ to publish to.
poetry_version: "==1.0.5" # (PIP version specifier syntax)
pypi_token: ${{ secrets.PYPI_TOKEN }}
build_format: "sdist"
allow_poetry_pre_release: "yes"
ignore_dev_requirements: "yes"
```
Repository can be changed to TestPyPI or a private wheels repo by specifying repository_name and repository_url.
```yaml
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
repository_name: "testpypi"
repository_url: "https://test.pypi.org/legacy/"
ignore_dev_requirements: "yes"
```
Repository authentication can be cahnged to http-basic authentification by specifying repository_username and repository_password instead of pypi_token.
```yaml
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
repository_name: "foo"
repository_url: "https://foo.bar/simple/"
repository_username: "username"
repository_password: "password"
```
## Example workflow
The following will build and publish the python package when project is tagged in the `v*.*.*` form.
Expand Down
20 changes: 14 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ inputs:
required: true
default: "latest"
pypi_token:
description: "API token to authenticate when uploading package to PyPI (https://pypi.org/manage/account/)"
required: true
build_format:
description: 'The build format to be used, either "sdist" or "wheel"'
description: "API token to authenticate when uploading package to PyPI (https://pypi.org/manage/account/) or TestPyPI (https://test.pypi.org/manage/account/)"
required: false
repository_name:
description: "Name of a repository where we will upload the package"
description: "Name of a repository where the package will be uploaded"
required: false
repository_url:
description: "URL where the package will be uploaded"
required: false
repository_username:
description: "Username to log in into a repository where the package will be uploaded if using http-basic authentification instead of api token"
required: false
repository_password:
description: "Password to log in into a repository where the package will be uploaded if using http-basic authentification instead of api token"
required: false
build_format:
description: 'The build format to be used, either "sdist" or "wheel"'
required: false
ignore_dev_requirements:
description: "Install project without developer requirements."
required: false
Expand All @@ -33,7 +39,7 @@ inputs:
required: false
runs:
using: "docker"
image: "docker://jrubics/poetry-publish:v1.8"
image: "docker://jrubics/poetry-publish:v1.9"
args:
- ${{ inputs.python_version }}
- ${{ inputs.poetry_version }}
Expand All @@ -43,3 +49,5 @@ runs:
- ${{ inputs.build_format }}
- ${{ inputs.ignore_dev_requirements }}
- ${{ inputs.allow_poetry_pre_release }}
- ${{ inputs.repository_username }}
- ${{ inputs.repository_password }}
11 changes: 8 additions & 3 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ if [ -z $4 ] || [ -z $5 ]; then
poetry config pypi-token.pypi $3
poetry publish
else
poetry config pypi-token.$4 $3
poetry config repositories.$4 $5
poetry publish --repository $4
if [ -z $9 ] || [ -z ${10} ]; then
poetry config pypi-token.$4 $3
poetry config repositories.$4 $5
poetry publish --repository $4
else
poetry config repositories.$4 $5
poetry publish --repository $4 --username $9 --password ${10}
fi
fi

0 comments on commit e22da00

Please sign in to comment.