(#8) udpate version [deploy] #27
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: Publish Python Package to PyPI | |
on: | |
push: | |
branches: | |
- dev | |
release: | |
types: [published] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.9' | |
- name: Install build tools | |
run: | | |
python -m pip install --upgrade pip | |
pip install build twine | |
- name: Check commit message for '[deploy]' | |
id: check-deploy | |
run: | | |
if ! git log -1 --pretty=%B | grep -q '\[deploy\]'; then | |
echo "No [deploy] tag found in the commit message. Skipping deployment." | |
exit 0 | |
fi | |
- name: Run deployment script | |
if: steps.check-deploy.outcome == 'success' | |
run: ./deploy.sh | |
env: | |
TWINE_USERNAME: "__token__" | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |