Skip to content

Commit

Permalink
Migrate from Travis CI to Github Actions for deploys
Browse files Browse the repository at this point in the history
  • Loading branch information
svintit committed Mar 2, 2023
1 parent 0f94ca8 commit b6071b7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 29 deletions.
31 changes: 3 additions & 28 deletions .github/scripts/release.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
#!/usr/bin/env python3
import json
import subprocess


def get_last_version() -> str:
"""Return the version number of the last release."""
json_string = (
subprocess.run(
["gh", "release", "view", "--json", "tagName"],
check=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
)
.stdout.decode("utf8")
.strip()
)

return json.loads(json_string)["tagName"]

__VERSION__ = "1.4.5"

def bump_patch_number(version_number: str) -> str:
"""Return a copy of `version_number` with the patch number incremented."""
Expand All @@ -27,19 +11,10 @@ def bump_patch_number(version_number: str) -> str:

def create_new_patch_release():
"""Create a new patch release on GitHub."""
try:
last_version_number = get_last_version()
except subprocess.CalledProcessError as err:
if err.stderr.decode("utf8").startswith("HTTP 404:"):
# The project doesn't have any releases yet.
new_version_number = "1.4.5"
else:
raise
else:
new_version_number = bump_patch_number(last_version_number)
# new_version_number = bump_patch_number(last_version_number)

subprocess.run(
["gh", "release", "create", "--generate-notes", new_version_number],
["gh", "release", "create", "--generate-notes", __VERSION__],
check=True,
)

Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from setuptools import setup

__VERSION__ = "1.4.5"

# This check is to make sure we checkout docs/_themes before running sdist
if not os.path.exists("./docs/_themes/README"):
print("Please make sure you have docs/_themes checked out while running setup.py!")
Expand Down Expand Up @@ -31,7 +33,7 @@
url="https://github.com/svintit/flask-oidc-ext",
author="Erica Ehrhardt, Patrick Uiterwijk, Traian Svinti",
author_email="[email protected]",
version="1.4.5",
version=__VERSION__,
packages=["flask_oidc_ext"],
install_requires=[
"Flask",
Expand Down

0 comments on commit b6071b7

Please sign in to comment.