-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
777aff3
commit 5bf9de0
Showing
1 changed file
with
20 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,50 @@ | ||
name: Publish Python Package | ||
# .github/workflows/publish.yml | ||
|
||
name: Publish Package | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
python-version: '3.11' # Set your Python version here | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install pytest | ||
run: pip install -r requirements.txt | ||
|
||
- name: Run tests | ||
run: pytest tests/ | ||
|
||
publish: | ||
runs-on: ubuntu-latest | ||
needs: test # Run only if tests succeed | ||
|
||
needs: test | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.x' | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install setuptools wheel twine | ||
run: pip install -r requirements.txt | ||
|
||
- name: Build package | ||
run: python setup.py sdist bdist_wheel | ||
|
||
- name: Publish package to PyPI | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
twine upload dist/* | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@v1.7.1 | ||
with: | ||
password: ${{ secrets.PYPI_API_TOKEN }} | ||
|