feat: add PDM distribution setting to pyproject.toml #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Wheels | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
include: | |
# Linux builds | |
- os: ubuntu-latest | |
python-version: '3.10' | |
- os: ubuntu-latest | |
python-version: '3.11' | |
- os: ubuntu-latest | |
python-version: '3.12' | |
# Windows builds | |
- os: windows-latest | |
python-version: '3.10' | |
- os: windows-latest | |
python-version: '3.11' | |
- os: windows-latest | |
python-version: '3.12' | |
# macOS builds | |
- os: macos-latest | |
python-version: '3.10' | |
- os: macos-latest | |
python-version: '3.11' | |
- os: macos-latest | |
python-version: '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install build dependencies | |
run: | | |
python -m pip install pdm | |
shell: bash | |
- name: Build wheel with dependencies | |
run: | | |
# Convert poetry project to pdm | |
pdm import -f poetry pyproject.toml | |
# Initialize PDM project | |
pdm init -n | |
# Enable distribution in pyproject.toml | |
echo -e "\n[tool.pdm]\ndistribution = true" >> pyproject.toml | |
# Build wheel with bundled dependencies | |
pdm build --no-sdist | |
# Move wheels to dist directory | |
mkdir -p dist | |
mv __pypackages__/*/*.whl dist/ | |
shell: bash | |
- name: Build source distribution | |
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' | |
run: pdm build --no-wheel | |
shell: bash | |
- name: Upload to GitHub Actions | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-py${{ matrix.python-version }} | |
path: dist/* | |
release: | |
needs: build_wheels | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
permissions: | |
contents: write | |
steps: | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
path: dist | |
merge-multiple: true | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/* |