Skip to content

Commit

Permalink
Update python-publish.yml (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
thejcannon authored Aug 11, 2023
1 parent c9fc4b0 commit 5d399a6
Showing 1 changed file with 40 additions and 19 deletions.
59 changes: 40 additions & 19 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# For more information see: https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
Expand All @@ -15,27 +15,48 @@ on:
permissions:
contents: read


jobs:
deploy:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-11]

steps:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/[email protected]

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl

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

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

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
# PyPI does not allow to upload wheels built using linux_x86_64
run: python -m build --sdist
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 5d399a6

Please sign in to comment.