Skip to content

Build and Publish

Build and Publish #2

name: Build and Publish
on:
workflow_run:
workflows: ["Building docs"]
types:
- completed
jobs:
build-and-publish:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install build-essential and make
run: |
sudo apt-get update
sudo apt-get install -y build-essential ca-certificates curl libffi-dev libgdbm-dev libncurses5-dev libnss3-dev libreadline-dev libssl-dev make time wget zlib1g-dev
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install PyTorch and dependencies from pyproject.toml
run: |
python -m pip install --upgrade pip
python -m pip install torch --index-url https://download.pytorch.org/whl/cpu
python -m pip install .[dev,docs]
- name: Build package
run: |
if [ "${{ matrix.python-version }}" = "3.12" ]; then
python -m build
else
python -m build --wheel
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.python-version }}
path: dist/
retention-days: 1
overwrite: true
publish:
needs: build-and-publish
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Prepare distribution files
run: |
mkdir -p final_dist
cp -r dist/*/* final_dist/
ls final_dist
# - name: Publish to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
# with:
# user: __token__
# password: ${{ secrets.PYPI_API_TOKEN }}
# packages_dir: final_dist/
# skip_existing: true