Skip to content

Update FEZrs_PyPI_Publish.yml #95

Update FEZrs_PyPI_Publish.yml

Update FEZrs_PyPI_Publish.yml #95

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: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools setuptools_scm wheel twine build
- name: Automatically bump version
run: |
OLD_VERSION=$(python setup.py --version)
echo "Current version: $OLD_VERSION"
NEW_VERSION=$(echo $OLD_VERSION | awk -F. -v OFS=. '{$NF++;print}')
echo "New version: $NEW_VERSION"
echo $NEW_VERSION > VERSION
git add VERSION
git commit -m "Bump version to $NEW_VERSION"
git tag $NEW_VERSION
- name: Commit & Push the New Version
env:
GH_PAT: ${{ secrets.GH_PAT }} # Use the Personal Access Token (PAT)
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git remote set-url origin https://x-access-token:$GH_PAT@github.com/${{ github.repository }}.git
git push origin main --tags
git push
- name: Build and Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m build
python -m twine upload dist/*