Skip to content

Commit

Permalink
build(ci): add semantic versioning and deployment to PYPI
Browse files Browse the repository at this point in the history
  • Loading branch information
mostaphaRoudsari committed Feb 4, 2021
1 parent f489e0c commit 98af41c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,34 @@ jobs:
pip install -r dev-requirements.txt
- name: run tests
run: python -m pytest tests/

deploy:
name: Deploy to GitHub and PyPI
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/master' && github.repository_owner == 'pollination'
steps:
- uses: actions/checkout@v2
- name: set up Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: set up node # we need node for for semantic release
uses: actions/[email protected]
with:
node-version: 14.2.0
- name: install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r dev-requirements.txt
- name: install semantic-release
run:
npm install @semantic-release/exec
- name: run semantic release
run:
npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PYPI_USERNAME: ${{ secrets.POLLINATION_PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.POLLINATION_PYPI_PASSWORD }}
13 changes: 13 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/github",
[
"@semantic-release/exec",
{
"publishCmd": "bash deploy.sh"
}
]
]
}
6 changes: 6 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

echo "Building distribution"
python setup.py sdist bdist_wheel
echo "Pushing new version to PyPi"
twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD

0 comments on commit 98af41c

Please sign in to comment.