Update website and change the banner #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Build wheel and upload to 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 | |
# Publish when a (published) GitHub Release is created | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "v*" | |
release: | |
jobs: | |
check-current-branch: | |
runs-on: ubuntu-latest | |
outputs: | |
branch: ${{ steps.check_step.outputs.branch }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get current branch | |
id: check_step | |
# 1. Get the list of branches ref where this tag exists | |
# 2. Remove 'origin/' from that result | |
# 3. Put that string in output | |
# => We can now use function 'contains(list, item)'' | |
run: | | |
raw=$(git branch -r --contains ${{ github.ref }}) | |
branch="$(echo ${raw//origin\//} | tr -d '\n')" | |
echo "{name}=branch" >> $GITHUB_OUTPUT | |
echo "Branches where this tag exists : $branch." | |
build_wheels: | |
name: Build universal wheels | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
- name: Build wheels | |
run: | | |
python setup.py bdist_wheel --universal | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
build_sdist: | |
name: Build source | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.11' | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools | |
- name: Build sdist | |
run: | | |
python setup.py sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
dist_check: | |
name: Check build with twine | |
runs-on: ubuntu-latest | |
needs: [build_wheels, build_sdist] | |
steps: | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: "3.11" | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install twine | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Check dist | |
run: | | |
twine check dist/* | |
upload_pypi: | |
name: Upload to PyPI | |
needs: [dist_check] | |
runs-on: ubuntu-latest | |
# upload to PyPI on every tag starting with 'v' | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.pypi_password }} | |
# End |