Skip to content

Refactor binary build #9

Refactor binary build

Refactor binary build #9

name: Build and publish GPU 🐍📦 to PyPI
on:
push:
tags:
- 'v*'
jobs:
build-n-publish-gpu:
if: startsWith(github.ref, 'refs/tags/')
name: Build and publish GPU 🐍📦 to PyPI
runs-on: ubuntu-latest
environment:
name: pypi-gpu
url: https://pypi.org/p/anylabeling-gpu
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python -m pip install build==1.2.2 twine==6.1.0 --user
- name: Set preferred device to GPU
run: >-
sed -i'' -e 's/\_\_preferred_device\_\_[ ]*=[ ]*\"[A-Za-z0-9]*\"/__preferred_device__ = "GPU"/g' anylabeling/app_info.py
- name: Build a binary wheel and a source tarball
run: >-
python -m build --wheel --outdir dist/ .
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true