Enhance Makefile and requirements management #29
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" | |
| on: | |
| push: | |
| paths: | |
| - 'setup.py' | |
| jobs: | |
| Pipeline: | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-22.04 | |
| container: python:3.7-buster | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Build package | |
| run: make package | |
| - name: Get new version | |
| run: echo "version=$(grep __version__ setup.py | head -1 | cut -d \" -f2 | cut -d \' -f2)" >> $GITHUB_ENV | |
| - name: Create release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ env.version }} | |
| release_name: Release ${{ env.version }} | |
| - name: Check if release already exists | |
| if: ${{ failure() }} | |
| run: echo Release already exist | |
| - name: Install Pypi requirement | |
| run: make requirements-dev | |
| - name: Publish release to pypi.org | |
| if: ${{ success() }} | |
| env: | |
| PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| run: PYTHONPATH=./pip/deps python -m twine upload -u $PYPI_USERNAME -p $PYPI_PASSWORD --verbose dist/* |