Skip to content

Commit

Permalink
Update publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Dec 22, 2023
1 parent f433b0e commit 87d0367
Showing 1 changed file with 37 additions and 56 deletions.
93 changes: 37 additions & 56 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: publish

on:
push:
branches:
- main
tags:
- 'v*.*.*'
on: push

jobs:
build_wheels:
Expand All @@ -18,69 +13,55 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.16.2

- name: Build wheels for Linux
if: matrix.os == 'ubuntu-latest'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *i686* *musllinux*"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_BEFORE_BUILD: pip install --verbose --editable .

- name: Build wheels for Windows
if: matrix.os == 'windows-latest'
run: |
python -m cibuildwheel --output-dir wheelhouse
env:
CIBW_SKIP: "pp* *i686* *win32"
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_BEFORE_BUILD: pip install --verbose --editable .

- name: Build wheels for macOS
if: matrix.os == 'macos-latest'
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64"
CIBW_SKIP: "pp* *i686*"
CIBW_BUILD: cp3*-*
CIBW_SKIP: pp* *i686* *win32 *musllinux*
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8"
CIBW_BEFORE_BUILD: pip install --verbose --editable .
CIBW_ARCHS_LINUX: auto64
CIBW_ARCHS_MACOS: x86_64 universal2 arm64
CIBW_ARCHS_WINDOWS: auto64

- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-artifact
name: artifact-wheels-${{ matrix.os }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.12'

- run: pip install build

- name: Build sdist
run: python -m build --sdist

- uses: actions/upload-artifact@v4
with:
name: artifact-source
path: dist/*.tar.gz

upload_pypi:
needs: build_wheels
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest

if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4

- uses: actions/download-artifact@v4
with:
name: artifact
pattern: artifact-*
path: dist

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
pip install twine
- name: Publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m build --sdist
twine upload dist/*
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
repository-url: https://test.pypi.org/legacy/

0 comments on commit 87d0367

Please sign in to comment.