From 951f920cdba3d44d081cb011fbb1539b03e4b377 Mon Sep 17 00:00:00 2001 From: kccwing <60852830+kccwing@users.noreply.github.com> Date: Thu, 29 Aug 2024 00:58:03 +0100 Subject: [PATCH] Create pypi_build.yaml --- .github/workflows/pypi_build.yaml | 93 +++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 .github/workflows/pypi_build.yaml diff --git a/.github/workflows/pypi_build.yaml b/.github/workflows/pypi_build.yaml new file mode 100644 index 000000000..4bcbbed19 --- /dev/null +++ b/.github/workflows/pypi_build.yaml @@ -0,0 +1,93 @@ +name: Create and publish pypi image + +on: + push: + branches: + - develop + - main + tags: + - 'v*' + +# env: +# REGISTRY: ghcr.io +# IMAGE_NAME: ${{ github.repository }} + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [3.10.8] + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v2 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Set up GCC + uses: egor-tensin/setup-gcc@v1 + with: + version: 10 + platform: x64 + - name: Pre-Install dependencies + run: | + gfortran --version + export QT_QPA_PLATFORM='offscreen' + sudo apt install libeigen3-dev + git submodule init + git submodule update + # git fetch --tags -f + # mkdir build && cd build + # cmake .. && make install -j 4 && cd .. + # pip install -e . + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Install wheel + run: python3 -m pip install wheel --user + - name: Build a binary wheel and a source tarball + # run: python3 setup.py sdist + # run: python3 -m pip install --user -e . + run: python3 setup.py bdist_wheel + # run: python setup.py bdist_wheel --universal + + + - name: Find the wheel created during pip install + run: + python3 -m pip cache dir + + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + # if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/icl_sharpy # Replace with your PyPI project name + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: + - name: Download all the dists + uses: actions/download-artifact@v3 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + # with: + # path: dist/*