From 31c2daa52e8e2a9dfd2d6c82644daf125abc7ece Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Fri, 2 Feb 2024 17:38:30 +0100 Subject: [PATCH 1/6] Add options --- README.md | 13 +++++++++---- action.yml | 6 +++--- entrypoint.sh | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 0007efd..d91eb5a 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,14 @@ The Password to log in into a repository where the package will be uploaded if u 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` +### `poetry_install_options` -This will instruct poetry **not** to install any developer requirements. this may lead to an overall quicker experience. +Adds possibility to pass options to "poetry install" command. Examples: + - `--without dev` + - `--only-root` + - `--sync` + +Check the full list [here](https://python-poetry.org/docs/cli/#options-2). ### `allow_poetry_pre_release` @@ -72,7 +77,7 @@ The following will build and publish the python package to the PyPI using the la pypi_token: ${{ secrets.PYPI_TOKEN }} ``` -Python and poetry versions can be specified in inputs as well as the build_format, allow_poetry_pre_release and ignore_dev_requirements. +Python and poetry versions can be specified in inputs as well as the build_format, allow_poetry_pre_release and poetry_install_options. ```yaml - name: Build and publish to pypi @@ -83,7 +88,7 @@ Python and poetry versions can be specified in inputs as well as the build_forma pypi_token: ${{ secrets.PYPI_TOKEN }} build_format: "sdist" allow_poetry_pre_release: "yes" - ignore_dev_requirements: "yes" + poetry_install_options: "--sync --no-root" ``` Repository can be changed to TestPyPI or a private wheels repo by specifying repository_name and repository_url. diff --git a/action.yml b/action.yml index 2c22ca8..d549aad 100644 --- a/action.yml +++ b/action.yml @@ -31,8 +31,8 @@ inputs: build_format: description: 'The build format to be used, either "sdist" or "wheel"' required: false - ignore_dev_requirements: - description: "Install project without developer requirements." + poetry_install_options: + description: 'Adds possibility to pass options to "poetry install" command' required: false allow_poetry_pre_release: description: "Allow usage of poetry pre-release and development versions" @@ -57,7 +57,7 @@ runs: - ${{ inputs.repository_name}} - ${{ inputs.repository_url }} - ${{ inputs.build_format }} - - ${{ inputs.ignore_dev_requirements }} + - ${{ inputs.poetry_install_options }} - ${{ inputs.allow_poetry_pre_release }} - ${{ inputs.repository_username }} - ${{ inputs.repository_password }} diff --git a/entrypoint.sh b/entrypoint.sh index 3f5520f..25a0c7c 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,10 +32,10 @@ if [ -n "${12}" ]; then poetry self add ${12} fi -if [ -z $7 ]; then +if [ -n "${7}" ]; then poetry install else - poetry install --no-dev + poetry install ${7} fi if [ -z $6 ]; then From 3529264d2237499aa7a2010ef6c290d2b5645a66 Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Sun, 4 Feb 2024 13:29:24 +0100 Subject: [PATCH 2/6] Add options --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d549aad..b7e3bc9 100644 --- a/action.yml +++ b/action.yml @@ -49,7 +49,7 @@ inputs: default: "." runs: using: "docker" - image: "docker://jrubics/poetry-publish:v1.17" + image: "docker://jrubics/poetry-publish:v2.0-rc.1" args: - ${{ inputs.python_version }} - ${{ inputs.poetry_version }} From b0c6fa16a97b6b5f6c2f71b0b700fbf8d9370a33 Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Sun, 4 Feb 2024 15:07:55 +0100 Subject: [PATCH 3/6] publish options --- README.md | 8 ++++++++ action.yml | 4 ++++ entrypoint.sh | 12 ++++-------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d91eb5a..48194e3 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,14 @@ Adds possibility to pass options to "poetry install" command. Examples: Check the full list [here](https://python-poetry.org/docs/cli/#options-2). +### `poetry_publish_options` + +Adds possibility to pass options to "poetry publish" command. Examples: + - `--dry-run` + - `--build` + +Check the full list [here](https://python-poetry.org/docs/cli/#options-8). + ### `allow_poetry_pre_release` Allow poetry pre-release versions to be installed. diff --git a/action.yml b/action.yml index b7e3bc9..fe48246 100644 --- a/action.yml +++ b/action.yml @@ -47,6 +47,9 @@ inputs: description: "An optional subdirectory path if poetry package doesn't reside in the main workflow directory" required: false default: "." + poetry_publish_options: + description: 'Adds possibility to pass options to "poetry publish" command' + required: false runs: using: "docker" image: "docker://jrubics/poetry-publish:v2.0-rc.1" @@ -64,3 +67,4 @@ runs: - ${{ inputs.extra_build_dependency_packages }} - ${{ inputs.plugins }} - ${{ inputs.package_directory }} + - ${{ inputs.poetry_publish_options }} diff --git a/entrypoint.sh b/entrypoint.sh index 25a0c7c..22a07b7 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -32,11 +32,7 @@ if [ -n "${12}" ]; then poetry self add ${12} fi -if [ -n "${7}" ]; then - poetry install -else - poetry install ${7} -fi +poetry install ${7} if [ -z $6 ]; then poetry build @@ -46,14 +42,14 @@ fi if [ -z $4 ] || [ -z $5 ]; then poetry config pypi-token.pypi $3 - poetry publish + poetry publish ${14} else if [ -z $9 ] || [ -z ${10} ]; then poetry config pypi-token.$4 $3 poetry config repositories.$4 $5 - poetry publish --repository $4 + poetry publish --repository $4 ${14} else poetry config repositories.$4 $5 - poetry publish --repository $4 --username $9 --password ${10} + poetry publish --repository $4 --username $9 --password ${10} ${14} fi fi From 330c18ccc4a49c35bb15dfbbe53282d43eab23a6 Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Sun, 4 Feb 2024 15:16:58 +0100 Subject: [PATCH 4/6] publish options --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 48194e3..a1b24bc 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ The following will build and publish the python package to the PyPI using the la pypi_token: ${{ secrets.PYPI_TOKEN }} ``` -Python and poetry versions can be specified in inputs as well as the build_format, allow_poetry_pre_release and poetry_install_options. +Python and poetry versions can be specified in inputs as well as the build_format, allow_poetry_pre_release, poetry_install_options and poetry_publish_options. ```yaml - name: Build and publish to pypi @@ -97,6 +97,7 @@ Python and poetry versions can be specified in inputs as well as the build_forma build_format: "sdist" allow_poetry_pre_release: "yes" poetry_install_options: "--sync --no-root" + poetry_publish_options: "--dry-run" ``` Repository can be changed to TestPyPI or a private wheels repo by specifying repository_name and repository_url. From 79f64164d5055080932fa5141f8c462ccec48ac5 Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Sun, 4 Feb 2024 19:47:08 +0100 Subject: [PATCH 5/6] Final --- README.md | 27 ++++++++++++++++++--------- action.yml | 2 +- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index a1b24bc..96ee47f 100644 --- a/README.md +++ b/README.md @@ -80,22 +80,31 @@ The following will build and publish the python package to the PyPI using the la ```yaml - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: pypi_token: ${{ secrets.PYPI_TOKEN }} ``` -Python and poetry versions can be specified in inputs as well as the build_format, allow_poetry_pre_release, poetry_install_options and poetry_publish_options. +Python and poetry versions can be specified in inputs as well as the build_format and allow_poetry_pre_release. ```yaml - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: python_version: "3.7.1" poetry_version: "==1.0.5" # (PIP version specifier syntax) pypi_token: ${{ secrets.PYPI_TOKEN }} build_format: "sdist" allow_poetry_pre_release: "yes" +``` + +Poetry options for install and publish commands can be specified through poetry_install_options and poetry_publish_options. + +```yaml +- name: Build and publish to pypi + uses: JRubics/poetry-publish@v2.0 + with: + pypi_token: ${{ secrets.PYPI_TOKEN }} poetry_install_options: "--sync --no-root" poetry_publish_options: "--dry-run" ``` @@ -104,7 +113,7 @@ Repository can be changed to TestPyPI or a private wheels repo by specifying rep ```yaml - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: pypi_token: ${{ secrets.PYPI_TOKEN }} repository_name: "testpypi" @@ -115,7 +124,7 @@ Repository authentication can be changed to http-basic authentification by speci ```yaml - name: Build and publish to private Python package repository - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: repository_name: "foo" repository_url: "https://foo.bar/simple/" @@ -127,7 +136,7 @@ Extra debian packages can be installed before building the python package. This ```yaml - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: pypi_token: ${{ secrets.PYPI_TOKEN }} extra_build_dependency_packages: "capnproto libzmq3-dev" @@ -137,7 +146,7 @@ Poetry plugins can be added by specifying plugins input ```yaml - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: pypi_token: ${{ secrets.PYPI_TOKEN }} plugins: "poetry-dynamic-versioning[plugin]" @@ -147,7 +156,7 @@ Poetry package can be built from a subdirectory. It should be specified as packa ```yaml - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: pypi_token: ${{ secrets.PYPI_TOKEN }} package_directory: "subdirectory" @@ -169,7 +178,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.17 + uses: JRubics/poetry-publish@v2.0 with: pypi_token: ${{ secrets.PYPI_TOKEN }} ``` diff --git a/action.yml b/action.yml index fe48246..cca2a36 100644 --- a/action.yml +++ b/action.yml @@ -52,7 +52,7 @@ inputs: required: false runs: using: "docker" - image: "docker://jrubics/poetry-publish:v2.0-rc.1" + image: "docker://jrubics/poetry-publish:v2.0" args: - ${{ inputs.python_version }} - ${{ inputs.poetry_version }} From 819b60e88e406152007dbc4922efb349af4e58e5 Mon Sep 17 00:00:00 2001 From: Jelena Dokic Date: Sun, 4 Feb 2024 19:50:25 +0100 Subject: [PATCH 6/6] Readme --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 96ee47f..6f66fe7 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,8 @@ An optional space-separated list of poetry plugins to be installed before buildi An optional subdirectory path if poetry package doesn't reside in the main workflow directory +**Note:** `ignore_dev_requirements` command is deprecated in version 2.0. Use `poetry_install_options: --without dev` instead + ## Example usage 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.