Add hosting of built wheel at PyPI - main #16
Workflow file for this run
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
name: Create and publish pypi image | |
on: | |
# only runs when there are pushes to develop and main for publishing | |
# and for testing, pull requests to develop and main | |
# and if there are changes to the build process and github action | |
push: | |
branches: | |
- develop | |
- main | |
paths: | |
- 'setup.py' | |
- '.github/workflows/pypi*' | |
pull_request: | |
branches: | |
- main | |
- develop | |
- 'rc*' | |
jobs: | |
create-pypi-image: | |
name: >- | |
Create .whl 🛞 from SHARPy distribution | |
runs-on: ubuntu-latest | |
env: | |
python-version-chosen: "3.10.8" | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ env.python-version-chosen }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ env.python-version-chosen }} | |
- name: Set up GCC | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: 4.8 | |
platform: x64 | |
- name: Pre-Install dependencies | |
run: | | |
export QT_QPA_PLATFORM='offscreen' | |
sudo apt install libeigen3-dev | |
git submodule init | |
git submodule update | |
- name: Install pypa/build | |
run: >- | |
python3 -m | |
pip install | |
build | |
--user | |
- name: Install wheel | |
run: python3 -m pip install wheel --user | |
- name: Build a source tarball | |
run: python setup.py sdist | |
- name: Build a binary wheel | |
run: python3 setup.py bdist_wheel | |
- name: Find the wheel created during pip install | |
run: | |
python3 -m pip cache dir | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publish-to-pypi: | |
name: >- | |
Publish Python 🐍 distribution 📦 to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes | |
needs: | |
- create-pypi-image | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/icl_sharpy # Replace <package-name> with your PyPI project name | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# path: dist/* |