-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Harness the github action to make a release
- Loading branch information
Showing
8 changed files
with
130 additions
and
14 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,29 @@ | ||
name: Publish | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
publish: | ||
name: "Publish release" | ||
runs-on: "ubuntu-latest" | ||
|
||
environment: | ||
name: deploy | ||
|
||
steps: | ||
- uses: "actions/checkout@v3" | ||
- uses: "actions/setup-python@v4" | ||
with: | ||
python-version: 3.8 | ||
- name: "Install dependencies" | ||
run: "scripts/install" | ||
- name: "Build package" | ||
run: "scripts/build" | ||
- name: "Publish to PyPI" | ||
run: "scripts/publish" | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__title__ = "pesapal_v3" | ||
__description__ = "A python wrapper of the Pesapal V3 payments API." | ||
__version__ = "0.1.0" |
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
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,21 +1,46 @@ | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[project] | ||
name = "pesapal_v3" | ||
version = "0.1.0" | ||
description = "Add your description here" | ||
authors = [ | ||
{ name = "Musale Martin", email = "martinmshale@gmail.com" } | ||
] | ||
dependencies = [] | ||
description = "A python wrapper of the Pesapal V3 payments API." | ||
authors = [{ name = "Musale Martin", email = "martinmshale@gmail.com" }] | ||
readme = "README.md" | ||
requires-python = ">= 3.8" | ||
|
||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
|
||
[tool.rye] | ||
managed = true | ||
dev-dependencies = [] | ||
classifiers = [ | ||
"Development Status :: Development", | ||
"Environment :: Web Environment", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: BSD License", | ||
"Operating System :: OS Independent", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Topic :: Internet :: WWW/HTTP", | ||
] | ||
dependencies = ["httpx>=0.24.1"] | ||
|
||
[tool.hatch.metadata] | ||
allow-direct-references = true | ||
|
||
[tool.ruff] | ||
select = ["E", "F", "I", "B", "PIE"] | ||
ignore = ["B904", "B028"] | ||
line-length = 120 | ||
|
||
[tool.ruff.isort] | ||
combine-as-imports = true | ||
|
||
[tool.mypy] | ||
ignore_missing_imports = true | ||
strict = true | ||
|
||
[[tool.mypy.overrides]] | ||
module = "tests.*" | ||
disallow_untyped_defs = false | ||
check_untyped_defs = true |
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 @@ | ||
httpx==0.24.1 |
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,13 @@ | ||
#!/bin/sh -e | ||
|
||
if [ -d 'venv' ] ; then | ||
PREFIX="venv/bin/" | ||
else | ||
PREFIX="" | ||
fi | ||
|
||
set -x | ||
|
||
${PREFIX}python -m build | ||
${PREFIX}twine check dist/* | ||
# ${PREFIX}mkdocs build |
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,19 @@ | ||
#!/bin/sh -e | ||
|
||
# Use the Python executable provided from the `-p` option, or a default. | ||
[ "$1" = "-p" ] && PYTHON=$2 || PYTHON="python3" | ||
|
||
REQUIREMENTS="requirements.txt" | ||
VENV="venv" | ||
|
||
set -x | ||
|
||
if [ -z "$GITHUB_ACTIONS" ]; then | ||
"$PYTHON" -m venv "$VENV" | ||
PIP="$VENV/bin/pip" | ||
else | ||
PIP="pip" | ||
fi | ||
|
||
"$PIP" install -U pip | ||
"$PIP" install -r "$REQUIREMENTS" |
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,26 @@ | ||
#!/bin/sh -e | ||
|
||
VERSION_FILE="pesapal/__version__.py" | ||
|
||
if [ -d 'venv' ] ; then | ||
PREFIX="venv/bin/" | ||
else | ||
PREFIX="" | ||
fi | ||
|
||
if [ ! -z "$GITHUB_ACTIONS" ]; then | ||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "GitHub Action" | ||
|
||
VERSION=`grep __version__ ${VERSION_FILE} | grep -o '[0-9][^"]*'` | ||
|
||
if [ "refs/tags/${VERSION}" != "${GITHUB_REF}" ] ; then | ||
echo "GitHub Ref '${GITHUB_REF}' did not match package version '${VERSION}'" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
set -x | ||
|
||
${PREFIX}twine upload dist/* | ||
# ${PREFIX}mkdocs gh-deploy --force |