Skip to content

Commit edf9eff

Browse files
author
João Guerreiro
committed
feat(pygitguardian): add pypi release channel
1 parent f34f210 commit edf9eff

File tree

4 files changed

+59
-18
lines changed

4 files changed

+59
-18
lines changed

.github/workflows/test-lint.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
33

4-
name: Package Test
4+
name: Main
55

66
on: [push, pull_request]
77

@@ -30,8 +30,8 @@ jobs:
3030
runs-on: ubuntu-latest
3131
strategy:
3232
matrix:
33+
os: [ubuntu-latest, macos-latest, windows-latest]
3334
python-version: [3.6, 3.7, 3.8]
34-
3535
steps:
3636
- uses: actions/checkout@v2
3737
- name: Set up Python ${{ matrix.python-version }}
@@ -47,3 +47,24 @@ jobs:
4747
run: |
4848
pipenv run coverage run --source pygitguardian -m nose tests
4949
pipenv run coverage report --fail-under=80
50+
51+
release:
52+
runs-on: ubuntu-latest
53+
needs: [lint, build]
54+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: Set up Python
58+
uses: actions/setup-python@v2
59+
with:
60+
python-version: "3.x"
61+
- name: Install dependencies
62+
run: python -m pip install --upgrade pip setuptools wheel
63+
- name: Build distribution
64+
run: >-
65+
python setup.py sdist bdist_wheel
66+
- name: Publish distribution 📦 to PyPI
67+
uses: pypa/gh-action-pypi-publish@master
68+
with:
69+
user: __token__
70+
password: ${{ secrets.pypi_password }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,4 @@ secret.py
121121
secrets
122122

123123
Pipfile.lock
124+
dist/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<img src="./doc/logo.svg">
1+
<img src="https://cdn.jsdelivr.net/gh/gitguardian/py-gitguardian/doc/logo.svg">
22

33
# GitGuardian API Client
44

setup.py

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,53 @@
1+
import io
2+
import os
13
import re
2-
from os.path import abspath, dirname, join
34

45
from setuptools import find_packages, setup
56

67

78
VERSION_RE = re.compile(r"__version__\s*=\s*\"(.*?)\"")
9+
HERE = os.path.abspath(os.path.dirname(__file__))
810

911

10-
def readme():
11-
with open(abspath("README.md")) as f:
12-
return f.read()
12+
def read(*args):
13+
"""Reads complete file contents."""
14+
return io.open(os.path.join(HERE, *args), encoding="utf-8").read()
1315

1416

15-
current_path = abspath(dirname(__file__))
17+
def get_version():
18+
"""Reads the version from this module."""
19+
init = read("pygitguardian", "__init__.py")
20+
return VERSION_RE.search(init).group(1)
1621

17-
with open(join(current_path, "pygitguardian", "__init__.py")) as file:
18-
content = file.read()
19-
result = re.search(VERSION_RE, content)
20-
if result is None:
21-
raise Exception("could not find package version")
22-
__version__ = result.group(1)
2322

2423
setup(
2524
name="pygitguardian",
26-
version=__version__,
25+
version=get_version(),
2726
packages=find_packages(exclude=["tests"]),
28-
description=readme(),
29-
install_requires=["marshmallow>=3.5", "requests>=2"],
30-
include_package_data=True,
27+
description="Python Wrapper for GitGuardian's API -- Scan security policy breaks everywhere",
28+
long_description=read("README.md"),
29+
long_description_content_type="text/markdown",
30+
url="https://github.com/GitGuardian/py-gitguardian",
3131
author="GitGuardian",
3232
author_email="[email protected]",
33+
maintainer="GitGuardian",
34+
install_requires=["marshmallow>=3.5", "requests>=2"],
35+
include_package_data=True,
3336
zip_safe=True,
37+
license="MIT",
38+
keywords="api-client devsecops secrets-detection security-tools library gitguardian",
39+
classifiers=[
40+
"Development Status :: 5 - Production/Stable",
41+
"Intended Audience :: Developers",
42+
"Natural Language :: English",
43+
"License :: OSI Approved :: MIT License",
44+
"Programming Language :: Python",
45+
"Programming Language :: Python :: 3",
46+
"Programming Language :: Python :: 3.4",
47+
"Programming Language :: Python :: 3.5",
48+
"Programming Language :: Python :: 3.6",
49+
"Programming Language :: Python :: 3.7",
50+
"Operating System :: OS Independent",
51+
"Topic :: Security",
52+
],
3453
)

0 commit comments

Comments
 (0)