Publishing Python package to PyPI (#29)

* Add GitHub Actions workflow for publishing Python package to PyPI and update pyproject.toml with project metadata

* Bump version to 1.0.0 in pyproject.toml
This commit is contained in:
Javier Callico 2026-02-08 14:40:30 -05:00 committed by GitHub
parent 13db9b2a30
commit b19e71c965
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 89 additions and 0 deletions

51
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,51 @@
name: Publish Python 🐍 distribution to PyPI
on:
release:
types: [published]
jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m pip install build --user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
publish-to-pypi:
name: Publish Python 🐍 distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/imap-migration-tools
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

View File

@ -1,6 +1,44 @@
# Ruff configuration for IMAP Migration Tools
# https://docs.astral.sh/ruff/
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "imap-migration-tools"
version = "1.0.0"
authors = [
{ name="Javier Callico", email="jcallico@callicode.com" },
{ name="Nathan Moinvaziri", email="nathan@nathanm.com" }
]
description = "Tools for migrating IMAP emails"
readme = "README.md"
requires-python = ">=3.9"
classifiers = [
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
]
dependencies = [
"google-auth-oauthlib",
"msal",
]
[project.urls]
"Homepage" = "https://github.com/jcallico/imap-migration-tools"
"Bug Tracker" = "https://github.com/jcallico/imap-migration-tools/issues"
[project.scripts]
imap-backup = "backup_imap_emails:main"
imap-restore = "restore_imap_emails:main"
imap-migrate = "migrate_imap_emails:main"
imap-count = "count_imap_emails:main"
imap-compare = "compare_imap_folders:main"
[tool.setuptools.package-dir]
"" = "src"
[tool.ruff]
target-version = "py39"
line-length = 120