Skip to content

Changed neurocorginet_fq to make it trainable #13

Changed neurocorginet_fq to make it trainable

Changed neurocorginet_fq to make it trainable #13

Workflow file for this run

# NeuroCorgi SDK, CeCILL-C license
# Publish pip package to PyPI
name: Publish to PyPI
on:
push:
branches: [master]
workflow_dispatch:
inputs:
pypi:
type: boolean
description: Publish to PyPI
jobs:
publish:
if: github.repository == 'CEA-LIST/neurocorgi_sdk' && github.actor == 'vtemplier'
name: Publish
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python environment
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip' # caching pip dependencies
- name: Install requirements
shell: bash
run: |
python -m pip install --upgrade pip wheel build twine
pip install . --extra-index-url https://download.pytorch.org/whl/cpu
- name: Check environment
run: pip list
- name: Check PyPI version
id: check_pypi
shell: python
run: |
import os
import neurocorgi_sdk
from neurocorgi_sdk.utils.checks import check_latest_pypi_version
v_local = tuple(map(int, neurocorgi_sdk.__version__.split('.')))
v_pypi = tuple(map(int, check_latest_pypi_version().split('.')))
print(f'Local version is {v_local}')
print(f'PyPI version is {v_pypi}')
d = [a - b for a, b in zip(v_local, v_pypi)] # version diff
# Only publish if patch version increments by 1 or 2
increment = (d[0] == d[1] == 0) and (0 < d[2] < 3)
os.system(f'echo "increment={increment}" >> $GITHUB_OUTPUT')
if increment:
print('Local version is higher than PyPI version. Publishing new version to PyPI ✅.')
- name: Build and publish to PyPI
continue-on-error: true
if: (github.event_name == 'push' || github.event.inputs.pypi == 'true') && steps.check_pypi.outputs.increment == 'True'
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
python -m build
python -m twine upload dist/* -u __token__ -p $PYPI_TOKEN