-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pypi upload action based on cibuildwheel example
- Loading branch information
1 parent
7e2765b
commit 95f82f3
Showing
2 changed files
with
26 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,24 @@ | ||
# Based on https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml | ||
# Permalink: https://github.com/pypa/cibuildwheel/blob/9c75ea15c2f31a77e6043b80b1b7081372319d85/examples/github-deploy.yml | ||
|
||
name: Build and upload to PyPI | ||
|
||
# Only run on releases | ||
on: | ||
push: | ||
# Pattern matched against refs/tags | ||
tags: | ||
- '**' # Push events to every tag including hierarchical tags like v1.0/beta | ||
# on: [push, pull_request] | ||
# on: | ||
# push: | ||
# # Pattern matched against refs/tags | ||
# tags: | ||
# - '**' # Push events to every tag including hierarchical tags like v1.0/beta | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build_wheels: | ||
name: Build wheels on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-20.04, macos-latest, windows-latest] | ||
# macos-13 is an intel runner, macos-14 is apple silicon | ||
os: [ubuntu-20.04, macos-13, macos-14, windows-latest] | ||
|
||
steps: | ||
- name: Checkout reposistory | ||
|
@@ -35,6 +39,7 @@ jobs: | |
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} | ||
path: ./wheelhouse/*.whl | ||
|
||
build_sdist: | ||
|
@@ -50,21 +55,27 @@ jobs: | |
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: cibw-sdist | ||
path: dist/*.tar.gz | ||
|
||
upload_pypi: | ||
needs: [build_wheels, build_sdist] | ||
runs-on: ubuntu-20.04 | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
environment: pypi | ||
permissions: | ||
id-token: write | ||
steps: | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifact | ||
# unpacks all CIBW artifacts into dist/ | ||
pattern: cibw-* | ||
path: dist | ||
merge-multiple: true | ||
|
||
- name: Publish to PyPI | ||
uses: pypa/[email protected] | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
with: | ||
user: __token__ | ||
password: ${{ secrets.pypi_password }} |
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