Release 6.0.0 #9
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
| name: publishing2PyPI | |
| on: | |
| release: | |
| types: [published] | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| jobs: | |
| build_and_publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Get package version | |
| run: | | |
| VERSION=NOT_SET | |
| VERSION=$(cat ./sift/version.py | grep -E -i '^VERSION.*' | cut -d'=' -f2 | cut -d\' -f2) | |
| [[ $VERSION == "NOT_SET" ]] && echo "Version in version.py NOT_SET" && exit 1 | |
| echo "curr_version=$(echo $VERSION)" >> $GITHUB_ENV | |
| - name: Compare package version and Release tag | |
| run: | | |
| TAG=${GITHUB_REF##*/} | |
| if [[ $TAG != *"$curr_version"* ]]; then | |
| echo "Version $curr_version does not match tag $TAG" | |
| exit 1 | |
| fi | |
| - name: Create distribution files | |
| run: | | |
| python -m pip install build | |
| python -m build | |
| - name: Upload distribution files | |
| env: | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| TWINE_USER: ${{ secrets.USER }} | |
| run: | | |
| python -m pip install --user --upgrade twine | |
| ls dist/ | xargs -I % python -m twine upload --repository pypi dist/% |