-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create GitHub action to publish the package to PyPI
- Loading branch information
Showing
3 changed files
with
36 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Release - Publish to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build twine | ||
- name: Build package | ||
run: | | ||
python -m build | ||
twine check dist/* | ||
- name: Publish package | ||
run: twine upload dist/* | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |
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,4 +1,4 @@ | ||
name: tests | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
|
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 |
---|---|---|
|
@@ -10,11 +10,10 @@ | |
|
||
long_description = "" | ||
try: | ||
from pypandoc import convert | ||
|
||
long_description = convert("README.md", "rst") | ||
except ImportError: | ||
print("warning: pypandoc module not found, could not convert Markdown to RST") | ||
with open("README.md") as f: | ||
long_description = f.read() | ||
except FileNotFoundError: | ||
print("warning: README.md not found, could not set long_description") | ||
|
||
|
||
def get_version(package): | ||
|
@@ -57,10 +56,6 @@ def get_package_data(package): | |
|
||
|
||
if sys.argv[-1] == "publish": | ||
try: | ||
import pypandoc | ||
except ImportError: | ||
print("pypandoc not installed.\nUse `pip install pypandoc`.\nExiting.") | ||
if os.system("pip freeze | grep twine"): | ||
print("twine not installed.\nUse `pip install twine`.\nExiting.") | ||
sys.exit() | ||
|
@@ -81,6 +76,7 @@ def get_package_data(package): | |
license="MIT", | ||
description="A simple django admin extension that shows when your periodic are going to run next", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
author="Vinta Software", | ||
author_email="[email protected]", | ||
packages=get_packages("celerybeat_status"), | ||
|