Giter VIP home page Giter VIP logo

py-package-publish-action's Introduction

Publish Python Package

A Github Action to build and publish your Python package to PyPI or any other repository. Supports any Python version you'll give it (that is also supported by pyenv).

Use

Pre-requisites

In order for the Action to have access to the code, you must use the actions/checkout@master job before it. See the example below.

Environment Variables/Secrets

  • Login credentials for the package repo (as specified by twine). So, for example:
    • TWINE_USERNAME=scott
    • TWINE_PASSWORD=tiger etc.
      This would also be where you'd set TWINE_REPOSITORY_URL if publishing to something other than PyPI.

Inputs

  • python_version: a Python version that is supported by pyenv. For example: 3.7.0.
  • pip_version (optional): the pip version to use (defaults to newest), some packages may require different pip versions.
  • subdir (optional): if your setup.py (and therefore, your entire package) is in a subdirectory of your repo, put the path to it here. This will just change the working directory to the SUBDIR before running the rest of the script.

Example workflow

name: publish-pypi

on:
  push:
    branches:
      - master

jobs:
  build:

    runs-on: ubuntu-latest
    
    steps:
    - uses: actions/checkout@master
    - name: Publish Python Package
      uses: mariamrf/[email protected]
      with:
        python_version: '3.6.0'
      env:
        TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
        TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}

py-package-publish-action's People

Contributors

mariamrf avatar uriyaharpeness avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

py-package-publish-action's Issues

Actions V2 support?

Hi, I was wondering if there are any plans for updates to support the new Actions configurations?

Outdated pip fails cryptography build.

Problem

When trying to use this action, because the version are not pinned, twines installation requires cryptography, and since version 3.4.1 it fails.

Error log

Collecting cryptography>=2.0 (from SecretStorage>=3.2; sys_platform == "linux"->keyring>=15.1->twine)
   Downloading https://files.pythonhosted.org/packages/06/ed/cb79cc94ec58d9d92557238fc6c629cd6e07d72334d2de556aecc2211370/cryptography-3.4.1.tar.gz (544kB)

...

     writing manifest file 'src/cryptography.egg-info/SOURCES.txt'
     running build_ext
     generating cffi module 'build/temp.linux-x86_64-3.6/_padding.c'
     creating build/temp.linux-x86_64-3.6
     generating cffi module 'build/temp.linux-x86_64-3.6/_openssl.c'
     running build_rust
     
         =============================DEBUG ASSISTANCE=============================
         If you are seeing a compilation error please try the following steps to
         successfully install cryptography:
         1) Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
         2) Read https://cryptography.io/en/latest/installation.html for specific
            instructions for your platform.
         3) Check our frequently asked questions for more information:
            https://cryptography.io/en/latest/faq.html
         4) Ensure you have a recent Rust toolchain installed.
         =============================DEBUG ASSISTANCE=============================
     
     error: Can not find Rust compiler
     
     ----------------------------------------
 Command "/root/.pyenv/versions/3.6.8/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-lj4n38_5/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-6nda508o/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-lj4n38_5/cryptography/
 You are using pip version 18.1, however version 21.0.1 is available.
 You should consider upgrading via the 'pip install --upgrade pip' command.

Solution

After updating pip to a newer version, the installation succeeds.

+++ b/entrypoint.sh
@@ -3,6 +3,7 @@
 install_python_version(){
        pyenv install $INPUT_PYTHON_VERSION
        pyenv global $INPUT_PYTHON_VERSION
+       pip install --upgrade pip
 }

Warning about `pip_version` as input.

Hi,

Thanks for the great Github Action! I followed the documentation, configuring pip_version, and received the following warning:

Warning: Unexpected input(s) 'pip_version', valid inputs are ['entryPoint', 'args', 'python_version', 'subdir']

Am I doing something wrong?

Thanks!

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.