Skip to content

Commit

Permalink
Use one action for PyPI and TestPyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainv committed Dec 18, 2023
1 parent 2627b63 commit efcb11c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 96 deletions.
File renamed without changes.
37 changes: 28 additions & 9 deletions .github/workflows/wheel-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
## Build wheel and upload to PyPI
## Build wheel and upload to TestPyPI (!! not PyPI !!)
## https://github.com/joerick/cibuildwheel/blob/master/examples/github-deploy.yml
## https://scikit-hep.org/developer/gha_wheels

name: Build wheel and upload to PyPI
# When new version on master branch
name: Build wheel and upload to PyPI or TestPyPI

# When push on branch dev
on:
push:
branches:
- master
tags:
- "v*"

env:
CONFIGURATIONS_FOLDER: .github/label-configuration-files
CONFIGURATIONS_ARTIFACT: label-configuration-files

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
Expand Down Expand Up @@ -48,7 +50,7 @@ jobs:
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.11'
python-version: "3.11"
- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip setuptools wheel
Expand All @@ -60,8 +62,8 @@ jobs:
path: dist/*.tar.gz

upload_pypi:
# upload to PyPI on every tag starting with 'v'
# if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
# Upload to PyPI for master branch
if: github.ref == "refs/heads/master"
name: Upload to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
Expand All @@ -75,4 +77,21 @@ jobs:
user: __token__
password: ${{ secrets.pypi_password }}

upload_testpypi:
# Upload to TestPyPI for dev branch
if: github.ref == "refs/heads/dev"
name: Upload to TestPyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
- uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/

# End
86 changes: 0 additions & 86 deletions .github/workflows/wheel-testpypi.yml

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def find_version():
long_description_content_type="text/x-rst",
classifiers=[
"Development Status :: 4 - Beta",
"License :: OSI Approved :: GNU General Public License v3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
Expand Down

0 comments on commit efcb11c

Please sign in to comment.