Skip to content

restored publish.yaml and publish_macos.yaml #158

restored publish.yaml and publish_macos.yaml

restored publish.yaml and publish_macos.yaml #158

Workflow file for this run

name: Publish Libraty to PyPI
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
include:
- python-version: "3.10"
python-path: "/opt/python/cp310-cp310/bin"
- python-version: "3.11"
python-path: "/opt/python/cp311-cp311/bin"
- python-version: "3.12"
python-path: "/opt/python/cp312-cp312/bin"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python for tests
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest
- name: Build Python wheels
run: |
python setup.py bdist_wheel
- name: Install wheel
run: |
pip install dist/*.whl
- name: Run tests
run: |
pytest tests/
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Build Docker image
run: |
docker build -t my-python-wheels .
- name: Run build script in Docker container
run: |
docker run --rm \
-e PYTHON_VERSION=${{ matrix.python-version }} \
-e PYTHON_PATH=${{ matrix.python-path }} \
-v ${{ github.workspace }}:/io \
my-python-wheels /build_wheel.sh
# - name: Check if version exists on PyPI
# id: check-version
# run: |
# PACKAGE_NAME=$(python setup.py --name)
# PACKAGE_VERSION=$(python setup.py --version)
# if curl --silent -f https://pypi.org/project/${PACKAGE_NAME}/${PACKAGE_VERSION}/; then
# echo "Version ${PACKAGE_VERSION} already exists on PyPI."
# echo "already_published=true" >> $GITHUB_ENV
# else
# echo "Version ${PACKAGE_VERSION} does not exist on PyPI."
# echo "already_published=false" >> $GITHUB_ENV
# fi
# - name: Upload Python wheels as artifacts
# uses: actions/upload-artifact@v4
# with:
# name: python-wheels
# path: dist/*.whl
- name: Publish wheels to PyPI
# if: env.already_published == 'false'
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}