GithubHelp home page GithubHelp logo

eqtylab-actions / poetry-publish Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jrubics/poetry-publish

0.0 0.0 0.0 56 KB

An action to build and publish python package to pypi (https://pypi.org/) using poetry (https://github.com/sdispater/poetry)

License: BSD 3-Clause "New" or "Revised" License

Shell 51.60% Dockerfile 48.40%

poetry-publish's Introduction

poetry-publish

Maintenance Latest release

An action to build and publish python package to PyPI, TestPyPI or a private wheels repo using poetry.

Inputs

python_version

The version of python to install (default: latest). Use default for a shorter build time.

poetry_version

The version of poetry to install (default: latest).

pypi_token

Required API token to authenticate when uploading package to PyPI (You can find your token here).

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.

repository_url

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.

poetry_install_options

Adds possibility to pass options to "poetry install" command. Examples:

  • --without dev
  • --only-root
  • --sync

Check the full list here.

poetry_publish_options

Adds possibility to pass options to "poetry publish" command. Examples:

  • --dry-run
  • --build

Check the full list here.

allow_poetry_pre_release

Allow poetry pre-release versions to be installed.

extra_build_dependency_packages

An optional space-separated list of debian packages to be installed before building the package

plugins

An optional space-separated list of poetry plugins to be installed before building the package

package_directory

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.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}

Python and poetry versions can be specified in inputs as well as the build_format and allow_poetry_pre_release.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  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.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    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.

- 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/"

Repository authentication can be changed to http-basic authentification by specifying repository_username and repository_password instead of pypi_token.

- name: Build and publish to private Python package repository
  uses: JRubics/[email protected]
  with:
    repository_name: "foo"
    repository_url: "https://foo.bar/simple/"
    repository_username: "username"
    repository_password: "password"

Extra debian packages can be installed before building the python package. This is particularly useful for packages that do not need to be included in the base image for this action.

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    extra_build_dependency_packages: "capnproto libzmq3-dev"

Poetry plugins can be added by specifying plugins input

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    plugins: "poetry-dynamic-versioning[plugin]"

Poetry package can be built from a subdirectory. It should be specified as package_directory

- name: Build and publish to pypi
  uses: JRubics/[email protected]
  with:
    pypi_token: ${{ secrets.PYPI_TOKEN }}
    package_directory: "subdirectory"

Example workflow

The following will build and publish the python package when project is tagged in the v*.*.* form.

name: Python package
on:
  push:
    tags:
      - "v*.*.*"
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Build and publish to pypi
        uses: JRubics/[email protected]
        with:
          pypi_token: ${{ secrets.PYPI_TOKEN }}

poetry-publish's People

Contributors

jrubics avatar agates avatar jelenadokic avatar ms7m avatar brianpugh avatar sam-writer avatar 0b11001111 avatar thehappydinoa avatar camilamaia avatar jessebot avatar tbruno25 avatar tmcclintock avatar vinigfer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.