Upload Python Package #5
Workflow file for this run
This file contains hidden or 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: Upload Python Package | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, windows-2022] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install prerequisites (Linux) | |
if: startsWith(runner.os, 'Linux') | |
run: | | |
sudo apt install libtbb-dev | |
- name: Setup Python 3.x | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
architecture: 'x64' | |
- name: Compile on Windows | |
if: startsWith(runner.os, 'Windows') | |
run: | | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -A x64 | |
cmake --build build --config Release | |
- name: Compile on Linux | |
if: startsWith(runner.os, 'Linux') | |
run: | | |
cmake -B build -DCMAKE_BUILD_TYPE=Release | |
cmake --build build | |
- name: Archive binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries-${{ matrix.os }} | |
path: ecospy/binaries | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure on Windows | |
if: startsWith(runner.os, 'Windows') | |
run: | | |
cmake -B build -DCMAKE_BUILD_TYPE=Release -A x64 | |
- name: Configure on Linux | |
if: startsWith(runner.os, 'Linux') | |
run: | | |
cmake -B build -DCMAKE_BUILD_TYPE=Release | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: binaries-* | |
path: ecospy/binaries | |
merge-multiple: true | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
cd ecospy | |
python setup.py sdist bdist_wheel | |
twine upload dist/* |