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

Commit

Permalink
Update webupdater release script
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed May 29, 2023
1 parent d7f2d93 commit 5c02038
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
3 changes: 1 addition & 2 deletions .github/workflow_data/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ cd ${ARTIFACT_DIR}
cd ../../..

python -m pip install pyncclient
export ARTIFACT_WEB="$(NC_FILE=${ARTIFACT_TGZ} NC_PATH=XFW-Updater python .github/workflow_data/webupdater.py)"
NC_FILE=${ARTIFACT_TGZ} NC_PATH=XFW-Updater python .github/workflow_data/webupdater.py

echo "ARTIFACT_TGZ=${ARTIFACT_TGZ}" >> $GITHUB_ENV
echo "ARTIFACT_WEB=${ARTIFACT_WEB}" >> $GITHUB_ENV
echo "ARTIFACT_ZIP=${ARTIFACT_ZIP}" >> $GITHUB_ENV
2 changes: 1 addition & 1 deletion .github/workflow_data/release.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## ⬇️ Download
>### [🖥️ Web Updater (chrome)](https://flipper-xtre.me/upate) [recommended]
>### [🖥️ Web Updater (chrome)](https://flipper-xtre.me/update) [recommended]
>### [🐬 qFlipper Package (.tgz)](https://github.com/ClaraCrazy/Flipper-Xtreme/releases/download/{VERSION_TAG}/{ARTIFACT_TGZ})
Expand Down
1 change: 0 additions & 1 deletion .github/workflow_data/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
template = f.read()
notes = template.format(
ARTIFACT_TGZ=os.environ['ARTIFACT_TGZ'],
ARTIFACT_WEB=os.environ['ARTIFACT_WEB'],
ARTIFACT_ZIP=os.environ['ARTIFACT_ZIP'],
VERSION_TAG=os.environ['VERSION_TAG'],
CHANGELOG=changelog
Expand Down
17 changes: 14 additions & 3 deletions .github/workflow_data/webupdater.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
import nextcloud_client
import json
import os

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
try:
client.delete(path)
except Exception:
pass
client.put_file(path, file)
share_link = client.share_file_with_link(path).get_link()
download_link = share_link.rstrip("/") + "/download/" + file
print(download_link, end="")

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)

0 comments on commit 5c02038

Please sign in to comment.