Merge pull request #40 from quadsproject/development #382
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: Publish Python Package | |
| on: | |
| push: | |
| branches: | |
| - latest | |
| jobs: | |
| publish: | |
| if: github.actor != 'github-actions[bot]' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.12' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel twine bump2version | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "grafuls@gmail.com" | |
| git config --global user.name "Your Name" | |
| - name: Bump version | |
| run: | | |
| if git rev-parse "v$(bump2version --dry-run --list patch | grep new_version | sed -r s,"^.*=",,)" >/dev/null 2>&1; then | |
| echo "Tag already exists. Skipping version bump." | |
| else | |
| bump2version patch | |
| fi | |
| - name: Build package | |
| run: python setup.py sdist bdist_wheel | |
| - name: Sync changes with all branches | |
| run: | | |
| git checkout latest | |
| git pull origin latest --rebase | |
| git push origin latest | |
| git checkout development | |
| git merge latest | |
| git push origin development | |
| - name: Publish package | |
| env: | |
| TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| run: twine upload dist/* |