Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy wheels to PyPI when pushing tags #248

Merged
merged 4 commits into from
Feb 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 28 additions & 10 deletions .github/workflows/build_deploy_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- main
- develop
tags:
- "**"

jobs:

deploy_wheels:
build_wheels:
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
Expand Down Expand Up @@ -75,15 +77,31 @@ jobs:
CIBW_BEFORE_BUILD_MACOS: bash {project}/build_tools/cibw_before_build_macos_arm.sh && meson setup --cross-file={project}/build_tools/x86_64-w64-arm64.ini build
CIBW_CONFIG_SETTINGS_MACOS: builddir=build

- name: Publish wheels to PyPI
if: startsWith(github.ref, 'refs/tags')
env:
TWINE_USERNAME: '__token__'
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
twine upload dist/*.whl --skip-existing

- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
path: ./wheelhouse/*.whl
path: ./wheelhouse/*.whl

upload_wheels:
needs: build_wheels
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: wheelhouse

- name: Move wheels to dist directory
run: |
mkdir dist
cp wheelhouse/**/*.whl dist
ls dist/

- name: Publish package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
packages_dir: dist/
skip_existing: true