Skip to content

Commit

Permalink
Update publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
tuttlepower committed Aug 3, 2024
1 parent 777aff3 commit 5bf9de0
Showing 1 changed file with 20 additions and 26 deletions.
46 changes: 20 additions & 26 deletions .github/workflows/publish.yml
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 }}

0 comments on commit 5bf9de0

Please sign in to comment.