-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #447 from chinapandaman/PPF-446
PPF-446: create deploy script
- Loading branch information
Showing
5 changed files
with
53 additions
and
1 deletion.
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
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 |
---|---|---|
|
@@ -7,3 +7,4 @@ pylint | |
pypdf | ||
pytest | ||
reportlab | ||
requests |
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,41 @@ | ||
# -*- coding: utf-8 -*- | ||
"""Creates a GitHub release.""" | ||
|
||
import re | ||
import sys | ||
|
||
import requests | ||
|
||
if __name__ == "__main__": | ||
with open("PyPDFForm/__init__.py", encoding="utf8") as f: | ||
version = re.search(r'__version__ = "(.*?)"', f.read()).group(1) | ||
|
||
latest_version = sys.argv[1].replace("(", "").replace(")", "") | ||
print(f"Latest deployed version: v{latest_version}.") | ||
if latest_version == version: | ||
sys.exit(f"v{latest_version} is already deployed.") | ||
|
||
print(f"Bumping to: v{version}") | ||
token = input("Enter GitHub Token: ") | ||
|
||
url = "https://api.github.com/repos/chinapandaman/PyPDFForm/releases" | ||
headers = { | ||
"Accept": "application/vnd.github+json", | ||
"Authorization": f"Bearer {token}", | ||
} | ||
body = { | ||
"tag_name": f"v{version}", | ||
"name": f"v{version}", | ||
"generate_release_notes": True, | ||
} | ||
|
||
response = requests.post( | ||
url=url, | ||
headers=headers, | ||
json=body, | ||
) | ||
|
||
if response.status_code == 201: | ||
print(f"Successfully deployed v{version}.") | ||
else: | ||
print(f"Failed deploying v{version}. Status code: {response.status_code}.") |
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,7 @@ | ||
if [[ "$VIRTUAL_ENV" == "" ]]; then | ||
source "./venv/bin/activate" | ||
fi | ||
|
||
echo "Fetching deployed versions..." | ||
LATEST=$(pip index versions PyPDFForm | grep -oP '\(.*?\)') | ||
python ./scripts/create_release.py "$LATEST" |
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