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

Add Github to PyPI integration #17

Merged
merged 2 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/publish-to-pipy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Publish Python distribution to PyPI

on: push

jobs:
publish-to-pypi:
name: Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/xlsx_streaming
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

sandre35 marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install pypa/build
run: pip install build
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
77 changes: 77 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
Releasing a new version
=======================

Installation
------------

Install Zest tool that automates process of releasing a new version of a Python package::

$ pip install zest.releaser

Clean master branch
-------------------

Make sure you are working on a safe master branch::

$ git checkout master
$ git reset origin/master --hard
$ make clean

Prerelease
----------

Once you are ready to release a new version, let's begin with the first command
``prerelease``. This command aims to change the setup.cfg's version and add the
current date to the changelog.

If you agree with the prefilled version, you can directly run::

$ prerelease --no-input

Otherwise, run the command without option. Zest will ask you a version number. Then
valid commit changes.

Release
-------

Then, let's focus on the ``release`` command. This command focuses on creating a tag and
uploading the new package to PyPI.

The command line asks you to valid the tag command. Press ``Y``

The next question is about uploading the package to a custom repository. Press ``n``.

Postrelease
-----------

Finally, it's time to prepare the project back to development and push commits remotely.

Run the command::

$ postrelease --feature

The first question is about the next development version. By default, the minor number
will be increased. If you want to enter another version, please do not add ``.dev0`` as
it is automatically added by Zest.

Then, valid commit changes. Press ``Y``.

Finally, you need to push local commits on the server. Press ``Y``.

Upload of the new release to PyPI
--------------------------------

This section is purely informative, everything is done automatically. Integration to
PyPI is done through the use of Github CI/CD. Declaration of the pipeline is done in
``.github/workflows/publish-to-pipy.yml``

On tag push, the job `publish-to-pypi` is triggered. The pipeline is composed of 3 main
steps:

* Setup Python and install build dependency
* Build the new project release
* Upload artifacts to PyPI

Setup of this pipeline is inspired from this `guide`_.

.. _guide: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
20 changes: 10 additions & 10 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ maintainer_email = [email protected]
license = GNU GPLv3
license_files = LICENSE
classifiers =
Development Status :: 5 - Production/Stable,
Intended Audience :: Developers,
License :: OSI Approved :: GNU General Public License v3 (GPLv3),
Natural Language :: English,
Operating System :: OS Independent,
Programming Language :: Python :: 3.8,
Programming Language :: Python :: 3.9,
Programming Language :: Python :: 3.10,
Programming Language :: Python :: 3.11,
Programming Language :: Python :: 3.12,
Development Status :: 5 - Production/Stable
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Natural Language :: English
Operating System :: OS Independent
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
keywords = xlsx, excel, streaming
platform = any

Expand Down