v0.2.1 #24
Workflow file for this run
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
| # This yml file will trigger a Github Actions event that builds and upload the | |
| # Python package to PiPy. This makes use of Twine and is triggered when a push | |
| # to the main branch occures. For more information see: | |
| # https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
| # Makes use of code from the CI Python versioner | |
| # https://github.com/grst/python-ci-versioneer/blob/master/.github/workflows/python-publish.yml | |
| name: Upload Python Package | |
| on: | |
| release: | |
| types: [created] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python | |
| uses: actions/setup-python@v2 | |
| with: | |
| python-version: '3.x' | |
| - name: Autobump version | |
| run: | | |
| # from refs/tags/v1.2.3 get 1.2.3 | |
| VERSION=$(echo $GITHUB_REF | sed 's#.*/v##') | |
| PLACEHOLDER='version="develop"' | |
| VERSION_FILE='setup.py' | |
| # ensure the placeholder is there. If grep doesn't find the placeholder | |
| # it exits with exit code 1 and github actions aborts the build. | |
| grep "$PLACEHOLDER" "$VERSION_FILE" | |
| sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/g" "$VERSION_FILE" | |
| # prints the contents of the setup file | |
| cat setup.py | |
| shell: bash | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install setuptools wheel twine | |
| - name: Build and publish | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| python setup.py sdist bdist_wheel | |
| twine upload dist/* |