Update hotfix script

This commit is contained in:
Willy-JL
2023-06-03 04:08:05 +01:00
parent 6326b7ff1f
commit 25eed74201
6 changed files with 42 additions and 19 deletions

View File

@@ -81,3 +81,7 @@ if __name__ == "__main__":
if not req.ok:
print(f"{req.url = }\n{req.status_code = }\n{req.content = }")
sys.exit(1)
changelog = body.split("## 🚀 Changelog", 1)[1].rsplit("## ❤️ Support", 1)[0]
with open(os.environ["ARTIFACT_TGZ"].removesuffix(".tgz") + ".md", "w") as f:
f.write(changelog.strip() + "\n\n")

View File

@@ -10,8 +10,5 @@ cd ${ARTIFACT_DIR}
7z a ../../../${ARTIFACT_ZIP} .
cd ../../..
python -m pip install pyncclient
NC_FILE=${ARTIFACT_TGZ} NC_PATH=XFW-Updater python .github/workflow_data/webupdater.py
echo "ARTIFACT_TGZ=${ARTIFACT_TGZ}" >> $GITHUB_ENV
echo "ARTIFACT_ZIP=${ARTIFACT_ZIP}" >> $GITHUB_ENV

View File

@@ -16,3 +16,5 @@ if __name__ == "__main__":
)
with open(notes_path, "w") as f:
f.write(notes)
with open(os.environ["ARTIFACT_TGZ"].removesuffix(".tgz") + ".md", "w") as f:
f.write(changelog.strip() + "\n\n")

View File

@@ -6,8 +6,8 @@ if __name__ == "__main__":
client = nextcloud_client.Client(os.environ["NC_HOST"])
client.login(os.environ["NC_USER"], os.environ["NC_PASS"])
file = os.environ["NC_FILE"]
path = os.environ["NC_PATH"] + "/" + file
file = os.environ["ARTIFACT_TGZ"]
path = f"XFW-Updater/{file}"
try:
client.delete(path)
except Exception:
@@ -16,12 +16,20 @@ if __name__ == "__main__":
file = file.removesuffix(".tgz") + ".md"
path = path.removesuffix(".tgz") + ".md"
with open(os.environ['GITHUB_EVENT_PATH'], "r") as f:
changelog = json.load(f)['pull_request']['body']
with open(file, "w") as f:
f.write(changelog)
try:
client.delete(path)
except Exception:
pass
client.put_file(path, file)
version = os.environ['VERSION_TAG'].split("_")[0]
files = (
os.environ['ARTIFACT_TGZ'],
os.environ['ARTIFACT_TGZ'].removesuffix(".tgz") + ".md"
)
for file in client.list("XFW-Updater"):
if file.name.startswith(version) and file.name not in files:
try:
client.delete(file.path)
except Exception:
pass