Skip to content
Merged
Changes from 1 commit
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
105 changes: 105 additions & 0 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Publish Package

# Builds hash-pinnable sdist + wheel artifacts for a published GitHub Release
# and publishes them to PyPI. This exists so downstream consumers (e.g.
# LineageWeave) can depend on fast-mlsirm through a normal versioned PyPI
# requirement with uv/pip hash pinning instead of an unhashable git source.
# See https://github.com/ContextualWisdomLab/.github/issues/1212.

on:
release:
types: [published]

permissions:
contents: read
Comment thread
seonghobae marked this conversation as resolved.
Resolved
Comment thread
seonghobae marked this conversation as resolved.
Resolved

concurrency:
group: publish-pypi-${{ github.event.release.tag_name }}
cancel-in-progress: false

jobs:
sdist:
name: sdist
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
with:
python-version: "3.12"
- name: Build sdist
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b
with:
command: sdist
args: --out dist
Comment thread
seonghobae marked this conversation as resolved.
Resolved
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: dist-sdist
path: dist

wheels:
name: wheels (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
manylinux: "2014"
- runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
manylinux: "2014"
- runner: macos-latest
target: universal2-apple-darwin
manylinux: ""
- runner: windows-latest
target: x86_64-pc-windows-msvc
manylinux: ""
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
with:
python-version: "3.12"
- name: Build wheel
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux || 'auto' }}
args: --release --out dist
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: dist-wheel-${{ matrix.target }}
path: dist

publish:
name: publish
needs: [sdist, wheels]
runs-on: ubuntu-latest
timeout-minutes: 15
environment: pypi
steps:
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: List built artifacts
run: ls -la dist
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97
with:
python-version: "3.12"
- name: Install twine
run: python -m pip install --upgrade twine
- name: Verify distributions
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
run: python -m twine check dist/*
- name: Attach release assets
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ github.event.release.tag_name }}" dist/* --repo "${{ github.repository }}" --clobber
Comment thread
github-actions[bot] marked this conversation as resolved.
Resolved
- name: Publish to PyPI
env:
TWINE_USERNAME: ${{ secrets.PIPY_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PIPY_TOKEN }}
Comment thread
github-actions[bot] marked this conversation as resolved.
Resolved
run: python -m twine upload --non-interactive dist/*
Comment thread
github-actions[bot] marked this conversation as resolved.
Resolved
Loading