Merge pull request #415 from Nota-NetsPresso/dev #12
Workflow file for this run
This file contains 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: Publish Python distributions 📦 to PyPI | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.8' | |
- name: Install pypa/setuptools | |
run: | | |
python -m pip install wheel twine | |
- name: Extract tag name | |
run: | | |
VERSION_TAG=${GITHUB_REF_NAME#v} | |
echo "VERSION_TAG=$VERSION_TAG" >> $GITHUB_ENV | |
- name: Extract version in package | |
run: | | |
VERSION_PKG=$(cat src/netspresso_trainer/VERSION) | |
echo "VERSION_PKG=$VERSION_PKG" >> $GITHUB_ENV | |
- name: Build a binary wheel if tag is valid | |
if: ${{ env.VERSION_TAG == env.VERSION_PKG }} | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |