Skip to content

Commit

Permalink
Introduce release workflow for PyPI deployment 🚀
Browse files Browse the repository at this point in the history
- Added `.github/workflows/release.yml` for automated release.
- Set up different jobs for building and uploading artifacts:
- Linux and macOS, both Intel and ARM architectures.
- Removed `.github/workflows/test-and-deploy.yml` as it’s deprecated.
- Ensured compatibility with Python 3.10 to 3.13.
- Utilized `pipx` and `cibuildwheel` for reliable build processes.
  • Loading branch information
horta committed Jan 6, 2025
1 parent bbf7df3 commit f88aa05
Show file tree
Hide file tree
Showing 2 changed files with 147 additions and 89 deletions.
147 changes: 147 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: 📦 Release

on:
push:
tags:
- v*

env:
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.10,<3.14"

jobs:
make_sdist:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Build SDist
run: pipx run build --sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

make_linux_intel_cp_wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup architecture
run: |
echo "CIBW_ARCHS_LINUX=x86_64" >> "$GITHUB_ENV"
echo "CIBW_BUILD=cp*" >> "$GITHUB_ENV"
- name: Build wheels
run: pipx run cibuildwheel==2.22.0

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

make_linux_arm_cp_wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup architecture
run: |
echo "CIBW_ARCHS_LINUX=aarch64" >> "$GITHUB_ENV"
echo "CIBW_BUILD=cp*" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build wheels
run: pipx run cibuildwheel==2.22.0

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

make_linux_intel_pp_wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup architecture
run: |
echo "CIBW_ARCHS_LINUX=x86_64" >> "$GITHUB_ENV"
echo "CIBW_BUILD=pp*" >> "$GITHUB_ENV"
- name: Build wheels
run: pipx run cibuildwheel==2.22.0

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

make_linux_arm_pp_wheels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup architecture
run: |
echo "CIBW_ARCHS_LINUX=aarch64" >> "$GITHUB_ENV"
echo "CIBW_BUILD=pp*" >> "$GITHUB_ENV"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
with:
platforms: all

- name: Build wheels
run: pipx run cibuildwheel==2.22.0

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

make_macos_intel_wheels:
runs-on: macos-13
steps:
- uses: actions/checkout@v3

- name: Set macOS deployment target
run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1-2)" >> $GITHUB_ENV

- name: Build wheels
run: pipx run cibuildwheel==2.22.0

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

make_macos_arm_wheels:
runs-on: macos-14
steps:
- uses: actions/checkout@v3

- name: Install autoconf
run: brew install autoconf

- name: Set macOS deployment target
run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion | cut -d '.' -f 1-2)" >> $GITHUB_ENV

- name: Build wheels
run: pipx run cibuildwheel==2.22.0

- uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl

upload_all:
needs: [make_linux_intel_cp_wheels, make_linux_arm_cp_wheels, make_linux_intel_pp_wheels, make_linux_arm_pp_wheels, make_macos_intel_wheels, make_macos_arm_wheels, make_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
89 changes: 0 additions & 89 deletions .github/workflows/test-and-deploy.yml

This file was deleted.

0 comments on commit f88aa05

Please sign in to comment.