Skip to content

Commit

Permalink
publishing source distribution to pypi (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
luccabb authored Feb 10, 2025
1 parent e663965 commit 951b4ad
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 25 deletions.
54 changes: 29 additions & 25 deletions .github/workflows/python-build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Build and Publish
name: Python Build and Publish

on:
push:
pull_request:

jobs:
linux-build:
build-wheels:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -35,18 +35,42 @@ jobs:
with:
name: wheels_${{ matrix.manylinux }}_${{ matrix.target }}
path: dist

build-sdist:
name: Build Source Distribution (sdist)
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"

- name: Install Maturin
run: pip install --upgrade maturin

- name: Build sdist
run: maturin sdist --out dist

- name: Upload sdist Artifact
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist

pypi-release:
name: Publish to Pypi
runs-on: ubuntu-latest
environment: pypi-publish
if: startsWith(github.ref, 'refs/tags/')
needs: [ linux-build ]
needs: [ build-wheels, build-sdist]
steps:
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
path: wheels
path: dist

- name: Python Setup
uses: actions/setup-python@v4
Expand All @@ -59,24 +83,4 @@ jobs:
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade twine
twine upload --skip-existing wheels/**/*.whl
cratesio-release:
name: Publish to Crates.io
runs-on: ubuntu-latest
environment: cratesio-publish
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish
twine upload --skip-existing dist/**/*.whl dist/**/*.tar.gz
26 changes: 26 additions & 0 deletions .github/workflows/rust-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Rust Build and Publish

on:
push:
pull_request:

jobs:
cratesio-release:
name: Publish to Crates.io
runs-on: ubuntu-latest
environment: cratesio-publish
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish

0 comments on commit 951b4ad

Please sign in to comment.