Skip to content

Commit

Permalink
Update pypi upload action based on cibuildwheel example
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Dec 16, 2024
1 parent 7e2765b commit 95f82f3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/pypi_upload.yml
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
Expand All @@ -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:
Expand All @@ -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 }}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- Try to fix Python releases again, again.
- Why are we still here? Just to suffer?

## [1.12.3] - 2024-12-16

### Fixed
Expand Down

0 comments on commit 95f82f3

Please sign in to comment.