Update FEZrs_PyPI_Publish.yml #73
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: PyPI Publish | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
pypi_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Automatically bump version in setup.py | |
run: | | |
VERSION=$(python setup.py --version) | |
echo "Current version is $VERSION" | |
# Increment the minor version (adjust as needed) | |
NEW_VERSION=$(echo $VERSION | awk -F. -v OFS=. '{$NF++;print}') | |
echo "New version is $NEW_VERSION" | |
# Update version in setup.py | |
sed -i "s/version=\"$VERSION\"/version=\"$NEW_VERSION\"/" setup.py | |
- name: Install dependencies and build PyPI package | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine build | |
python -m build | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
run: | | |
python -m twine upload dist/* |