Skip to content
Open
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
144 changes: 144 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Publish package to PyPI

on:
push:

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13", "3.12", "3.11", "3.10"]

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install the latest version of uv and set the python ${{matrix.python-version}}
uses: astral-sh/setup-uv@v6
with:
python-version: ${{ matrix.python-version }}

- name: Build
run: |
uv run python setup.py build_ext -i
uv run python setup.py sdist

- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-${{matrix.python-version}}
path: dist/

publish-to-pypi:
name: >-
Publish package 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/rusty-iterators
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


merge-artifacts:
name: Merge artifacts from all builds
runs-on: ubuntu-latest
needs: build

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: all-dists/

- name: Move all artifacts to dist/
run: |
mkdir dist
find all-dists/ -type f -name '*.tar.gz' -exec cp {} dist/ \;
find all-dists/ -type f -name '*.whl' -exec cp {} dist/ \;

- name: Upload merged artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

test-pypi:
name: Publish to TestPyPI
needs: merge-artifacts
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/rusty-iterators
permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/


github-release:
name: >-
Sign the package with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/[email protected]
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
"$GITHUB_REF_NAME"
--repo "$GITHUB_REPOSITORY"
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
"$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY"
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "rusty-iterators"
version = "1.0.0"
version = "0.1.1"
description = "Rust-like iterators in Python."
authors = [{ name = "Wiktor Nowak" }, { name = "Dawid Sielużycki" }]
requires-python = ">=3.10,<3.14"
Expand Down Expand Up @@ -34,6 +34,9 @@ all = [
[tool.uv]
default-groups = ["dev"]

[tool.uv.pip]
extra-index-url = ["https://pypi.org/simple"]

[tool.ruff]
line-length = 119

Expand Down
Loading
Loading