mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-25 03:29:58 -07:00
Update hotfix script
This commit is contained in:
4
.github/workflow_data/hotfix.py
vendored
4
.github/workflow_data/hotfix.py
vendored
@@ -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")
|
||||
|
||||
3
.github/workflow_data/package.sh
vendored
3
.github/workflow_data/package.sh
vendored
@@ -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
|
||||
|
||||
2
.github/workflow_data/release.py
vendored
2
.github/workflow_data/release.py
vendored
@@ -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")
|
||||
|
||||
20
.github/workflow_data/webupdater.py
vendored
20
.github/workflow_data/webupdater.py
vendored
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user