Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,7 @@ jobs:
name: build and publish to pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set version from tag
if: startsWith(github.ref, 'refs/tags')
run: |
# from refs/tags/1.2.3 get 1.2.3
VERSION=$( basename $GITHUB_REF )
PLACEHOLDER='__version__ = "0.0.0"'
VERSION_FILE='gwh/__version__.py'
# fail out if placeholder not found
grep "$PLACEHOLDER" "$VERSION_FILE"
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/" "$VERSION_FILE"
shell: bash
- uses: actions/checkout@v5

- name: install, test cli
run: |
Expand All @@ -29,12 +17,12 @@ jobs:

- name: install dependencies & build
run: |
pip3 install setuptools wheel
python3 setup.py sdist bdist_wheel
pip3 install build
python3 -m build

- name: publish to PyPi
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
password: ${{ secrets.PYPI_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
name: build and publish to testpypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v5

- name: install, test cli
run: |
Expand All @@ -14,8 +14,8 @@ jobs:

- name: install dependencies & build
run: |
pip3 install setuptools wheel
python3 setup.py sdist bdist_wheel
pip3 install build
python3 -m build

- name: publish to Test PyPi
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
16 changes: 11 additions & 5 deletions gwh/__main__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import argparse
import json

from .__version__ import (
__package__,
__version__
)
from importlib.metadata import version, PackageNotFoundError

try:
__version__ = version("gwh")
except PackageNotFoundError:
__version__ = "unknown"

from gwh import app
import gwh

if __name__ == "__main__":
def main():
parser = argparse.ArgumentParser(prog="python -m gwh", description="GitLab webhook handler")
parser.add_argument("config", help="path to repos configuration")
parser.add_argument("--version", action="version", version=__package__ + " " + __version__)
Expand All @@ -30,3 +33,6 @@
app.debug = args.debug

app.run(host=args.host, port=args.port)

if __name__ == "__main__":
main()
3 changes: 0 additions & 3 deletions gwh/__version__.py

This file was deleted.

32 changes: 32 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[build-system]
requires = ["setuptools>=40.6.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "gwh"
version = "1.1.0"
description = "Webhook Handler for GitLab"
readme = "README.md"
authors = [
{ name = "Andy Hebrank", email = "ahebrank@gmail.com" }
]
license = "Apache-2.0"
requires-python = ">=3.8"
dependencies = [
"Flask>=1.0",
"requests>=2.19.0"
]

[project.urls]
Homepage = "https://github.com/ahebrank/gitlab-webhook-handler"
Repository = "https://github.com/ahebrank/gitlab-webhook-handler.git"
Issues = "https://github.com/ahebrank/gitlab-webhook-handler/issues"

[tool.setuptools]
packages = ["gwh"]

[tool.setuptools.package-data]
gwh = ["repos.json.example"]

[project.scripts]
gwh = "gwh.__main__:main"
24 changes: 0 additions & 24 deletions setup.py

This file was deleted.

Loading