Fixed bumpversion #2
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 Package | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [closed] | |
branches: | |
- main | |
jobs: | |
deploy: | |
if: >- | |
(github.event_name == 'push' || | |
(github.event_name == 'pull_request' && github.event.pull_request.merged == true)) && | |
github.event.head_commit.author.email != '[email protected]' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build bump2version | |
- name: Bump version | |
run: | | |
current_version=$(bump2version --dry-run --list minor | grep current_version | sed -r s,"^.*=",,) | |
new_version=$(bump2version --dry-run --list minor | grep new_version | sed -r s,"^.*=",,) | |
bump2version --new-version $new_version minor | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git commit -am "Bump minor version [skip ci]" | |
git push | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |