v0.2.51 #67
Workflow file for this run
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: Upload to PIP | |
on: | |
# Triggers the workflow when a release is created | |
release: | |
types: [created] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
upload: | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out repository under $GITHUB_WORKSPACE | |
- name: "Checkout repository and submodules" | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
# Set up python | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
# Set package version number | |
- name: Set version number to release number | |
run: | | |
VERSION=${{github.event.release.tag_name}} | |
PLACEHOLDER='version="main"' | |
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" | |
shell: bash | |
# Install dependencies | |
- name: "Install dependencies" | |
run: | | |
python3 -m pip install --upgrade pip | |
python3 -m pip install setuptools wheel twine | |
# Build and upload to PyPI | |
- name: "Build and upload to PyPI" | |
run: | | |
python3 setup.py sdist bdist_wheel | |
python3 -m twine upload dist/* --verbose | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.TWINE_TOKEN }} |