Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish package in PyPI #106

Open
reingart opened this issue Mar 19, 2023 · 2 comments
Open

Publish package in PyPI #106

reingart opened this issue Mar 19, 2023 · 2 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@reingart
Copy link
Member

We need a new GitHub Action workflow to automatically publish this package to PyPI (Python Package Index)

This will be useful for other project, to ease their installation.
For example see a thread for the Odoo Argentine localization: reingart#102

How-To:
https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/

The GitHub Action pypa/gh-action-pypi-publish could be easily added to .github//workflows/python-package.yml:

    - name: Publish distribution 📦 to Test PyPI
      uses: pypa/gh-action-pypi-publish@release/v1
      with:
        password: ${{ secrets.TEST_PYPI_API_TOKEN }}
        repository_url: https://test.pypi.org/legacy/

This action should only run if secrets.TEST_PYPI_API_TOKEN is configured

@reingart reingart added the good first issue Good for newcomers label Mar 19, 2023
@baivab85
Copy link

baivab85 commented Mar 2, 2024

Yes workflow is extremely necessary. So I want to work over this issue.

@baivab85
Copy link

baivab85 commented Mar 2, 2024

name: Publish Python 🐍 distributions 📦 to PyPI and Test PyPI

on:
push:
branches:
- master

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and Test PyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install pip
  run: python -m pip install --upgrade pip

- name: Install dependencies
  run: |
    python -m pip install --upgrade setuptools wheel twine

- name: Build package
  run: python setup.py sdist bdist_wheel

- name: Publish distribution 📦 to PyPI
  uses: pypa/gh-action-pypi-publish@master
  with:
    user: __token__
    password: ${{ secrets.PYPI_API_TOKEN }}

- name: Publish distribution 📦 to Test PyPI
  if: secrets.TEST_PYPI_API_TOKEN != ''
  uses: pypa/gh-action-pypi-publish@release/v1
  with:
    user: __token__
    password: ${{ secrets.TEST_PYPI_API_TOKEN }}
    repository_url: https://test.pypi.org/legacy/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants