Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Fix hotfix script again
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed May 4, 2023
1 parent dbade67 commit 103abfe
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions .github/workflow_data/hotfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@
}
).json()

artifacts = (
os.environ['ARTIFACT_TGZ'],
os.environ['ARTIFACT_ZIP']
)
artifacts = {
os.environ['ARTIFACT_TGZ']: "application/gzip",
os.environ['ARTIFACT_ZIP']: "application/zip"
}

for asset in release["assets"]:
if asset["name"] in artifacts:
req = requests.delete(
asset["url"],
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.environ['GITHUB_TOKEN']}"
}
)
if not req.ok:
print(f"{req.url = }\n{req.status_code = }\n{req.content = }")
sys.exit(1)
req = requests.delete(
asset["url"],
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.environ['GITHUB_TOKEN']}"
}
)
if not req.ok:
print(f"{req.url = }\n{req.status_code = }\n{req.content = }")
sys.exit(1)

for artifact in artifacts:
for artifact, mediatype in artifacts.items():
req = requests.post(
release["upload_url"].rsplit("{?", 1)[0],
headers={
"Accept": "application/vnd.github.v3+json",
"Authorization": f"token {os.environ['GITHUB_TOKEN']}"
"Authorization": f"token {os.environ['GITHUB_TOKEN']}",
"Content-Type": mediatype
},
params={
"name": artifact
Expand All @@ -59,8 +59,13 @@

body = release["body"]
body = re.sub(
r"(https://lab\.flipper\.net/\?url=).*?(&channel=XFW-Updater&version=" + os.environ['VERSION_TAG'] + r")",
r"\1" + os.environ['ARTIFACT_WEB'] + r"\2",
r"(https://lab\.flipper\.net/\?url=).*?(&channel=XFW-Updater&version=)[A-Za-z0-9_-]+",
r"\1" + os.environ['ARTIFACT_WEB'] + r"\2" + os.environ['VERSION_TAG'],
body
)
body = re.sub(
r"(https://github\.com/ClaraCrazy/Flipper-Xtreme/releases/download/[A-Za-z0-9_-]+?/)[A-Za-z0-9_-]+",
r"\1" + os.environ['VERSION_TAG'],
body
)
body = body.replace("<!--- <HOTFIXES>\n", "")
Expand Down

0 comments on commit 103abfe

Please sign in to comment.