Check & Deploy #12
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: Check & Deploy | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
check-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout git repository | |
uses: actions/checkout@v2 | |
with: | |
submodules: true | |
path: _src/ | |
- name: Install Python dependencies | |
run: | | |
pushd _src | |
pip install .[sampling,plotting,testing] | |
pip install pytest | |
popd | |
- name: Test with pytest | |
run: | | |
pushd _src | |
pytest | |
popd | |
- name: Verify release version matches source code version | |
shell: bash | |
run: | | |
pushd _src | |
export TAG_VERSION=${GITHUB_REF##refs/tags/v} | |
export SRC_VERSION=$(python3 -c "from flavio._version import __version__; print(__version__)") | |
if [[ ${TAG_VERSION} != ${SRC_VERSION} ]] ; then | |
echo "tag/release version and source code version disagree, exiting" | |
exit 1 | |
fi | |
popd | |
- name: Build bdist | |
shell: bash | |
run: | | |
mkdir dist | |
pushd _src | |
python3 ./setup.py sdist -d ../dist/ | |
python3 ./setup.py bdist_wheel -d ../dist/ | |
popd | |
- name: Test installing the wheel | |
shell: bash | |
run: | | |
python3 -m pip install dist/flavio-*.whl | |
- name: Upload build as artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: flavio-dist-${{ github.sha }} | |
path: dist | |
- name: Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: ${{ secrets.TWINE_USERNAME }} | |
password: ${{ secrets.TWINE_PASSWORD }} |