Release Python Package to PyPI #18
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: Release Python Package to PyPI | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Setup | |
| run: pip install poetry poetry-dynamic-versioning | |
| - name: Config | |
| run: poetry config repositories.pypi https://upload.pypi.org/legacy/ | |
| - name: Build subpackages | |
| run: | | |
| # Build tests subpackage | |
| cd tests | |
| poetry build | |
| export VERSION=$(poetry version -s) | |
| cd .. | |
| # Build notebooks subpackage | |
| cd notebooks | |
| poetry build | |
| cd .. | |
| # Update main pyproject.toml with the correct version | |
| sed -i "s/finn-plus-tests = { version = \"\*\", optional = true }/finn-plus-tests = { version = \"$VERSION\", optional = true }/" pyproject.toml | |
| sed -i "s/finn-plus-notebooks = { version = \"\*\", optional = true }/finn-plus-notebooks = { version = \"$VERSION\", optional = true }/" pyproject.toml | |
| - name: Build main package | |
| run: | | |
| poetry build | |
| - name: Publish all packages | |
| run: | | |
| # Publish tests subpackage | |
| cd tests | |
| poetry publish -r pypi -u __token__ -p ${{ secrets.PYPI_TOKEN }} | |
| cd .. | |
| # Publish notebooks subpackage | |
| cd notebooks | |
| poetry publish -r pypi -u __token__ -p ${{ secrets.PYPI_TOKEN }} | |
| cd .. | |
| # Publish main package | |
| poetry publish -r pypi -u __token__ -p ${{ secrets.PYPI_TOKEN }} | |
| test: | |
| runs-on: ubuntu-24.04 | |
| needs: deploy | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Setup | |
| run: pip install poetry poetry-dynamic-versioning | |
| - name: Install | |
| run: pip install finn-plus[all]==$(poetry version -s) |