Skip to content

Commit

Permalink
wheels to pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
lobis committed Dec 8, 2023
1 parent 1c6ea3a commit 9cb8731
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
platform: [ubuntu-latest, macos-latest]

steps:
- uses: lukka/get-cmake@latest
- uses: lukka/get-cmake@v3.27.9

- name: Cache Xerces-C Installation
id: cache-xerces
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- uses: lukka/get-cmake@latest
- uses: lukka/get-cmake@v3.27.9

- name: Cache Xerces-C Installation
id: cache-xerces
Expand Down
56 changes: 46 additions & 10 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ name: Wheels

on:
workflow_dispatch:
push:
branches: [main]
inputs:
publish_to_test_pypi:
type: boolean
description: Publish to Test PyPI
default: false

env:
GEANT4_VERSION: 11.2.0
Expand All @@ -24,8 +27,6 @@ jobs:

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Build sdist
run: |
Expand All @@ -34,10 +35,10 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: sdist
name: dist
path: dist/*.tar.gz

wheel:
wheels:
name:
Build wheel for cp${{ matrix.python }}-${{ matrix.platform_id }}-${{
matrix.manylinux_image }}
Expand Down Expand Up @@ -92,12 +93,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: lukka/get-cmake@latest
- uses: lukka/get-cmake@v3.27.9

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11

- uses: pypa/cibuildwheel@v2.16.2
env:
Expand Down Expand Up @@ -138,5 +137,42 @@ jobs:
- name: Upload Wheels
uses: actions/upload-artifact@v3
with:
name: wheels
name: dist
path: wheelhouse/*.whl

upload-test-pypi:
name: Upload wheels to PyPI
needs: [sdist, wheels]
runs-on: ubuntu-latest
if: github.event.inputs.publish_to_test_pypi

steps:
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Publish to Test PyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/

upload-pypi:
name: Upload wheels to PyPI
needs: [sdist, wheels]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'

steps:
- uses: actions/setup-python@v4
- uses: actions/download-artifact@v3
with:
name: dist
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.11
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 9cb8731

Please sign in to comment.