Skip to content

Commit

Permalink
159 create an action to publish to pypi when we make a release (#184)
Browse files Browse the repository at this point in the history
* testing automated pypi release

* trying to appropriately name the wheels

* only need one version of python to build wheels for all other versions

* trying to get macos to build successfully

* excluding universal2 arch build for macos

* seeing if arm64 works

* trying to skip musllinux

* trying to choose linux architecture support

* trying to skip musllinux again

* adding intel based mac build

* trying to set the osx deployment target

* trying a different way

* that wasn't it

* trying to force a minimum of 10.15 for macos?

* setting action trigger

* undoing version change

* correcting project name
  • Loading branch information
K20shores authored Aug 7, 2024
1 parent 5951afd commit 879d5e9
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
85 changes: 85 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Publish Python Package

on:
workflow_dispatch:
release:
types:
- published

jobs:
build_sdist:
name: Build SDist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true

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

- name: Check metadata
run: pipx run twine check dist/*

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

build_wheels:
name: Build wheels on ${{ matrix.os }} with Python ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- uses: pypa/cibuildwheel@v2.17
env:
CIBW_ARCHS_MACOS: arm64 x86_64
CIBW_SKIP: cp27-* cp34-* cp35-* cp36-* *musllinux*
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*

- name: Verify clean directory
run: git diff --exit-code
shell: bash

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

upload_all:
name: Upload release
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/musica
permissions:
id-token: write

steps:
- uses: actions/setup-python@v5
with:
python-version: "3.x"

- uses: actions/download-artifact@v4
with:
pattern: cibw-*
path: dist
merge-multiple: true

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,7 @@ regex = 'musica-distribution VERSION\s+(?P<value>[0-9.]+)'
path = "musica/_version.py"
template = '''
version = "${version}"
'''
'''

[tool.cibuildwheel.macos.environment]
MACOSX_DEPLOYMENT_TARGET = "10.15"

0 comments on commit 879d5e9

Please sign in to comment.