diff --git a/.github/workflow_data/devbuild.py b/.github/workflow_data/devbuild.py index 2f00e8a874..a3c05f9545 100644 --- a/.github/workflow_data/devbuild.py +++ b/.github/workflow_data/devbuild.py @@ -1,31 +1,17 @@ #!/usr/bin/env python -import nextcloud_client import datetime as dt import requests import json import os -dev_share_id = "" -dev_share = os.environ["NC_HOST"] + f"s/{dev_share_id}/download?path=/&files={{files}}" +artifact_tgz = f"{os.environ['INDEXER_URL']}/firmware/dev/{os.environ['ARTIFACT_TAG']}.tgz" +artifact_sdk = f"{os.environ['INDEXER_URL']}/firmware/dev/{os.environ['ARTIFACT_TAG'].replace('update', 'sdk')}.zip" + if __name__ == "__main__": with open(os.environ["GITHUB_EVENT_PATH"], "r") as f: event = json.load(f) - client = nextcloud_client.Client(os.environ["NC_HOST"]) - client.login(os.environ["NC_USER"], os.environ["NC_PASS"]) - - for file in ( - os.environ["ARTIFACT_TGZ"], - os.environ["ARTIFACT_SDK"], - ): - path = f"MNTM-Dev/{file}" - # try: - # client.delete(path) - # except Exception: - # pass - client.put_file(path, file) - requests.post( os.environ["BUILD_WEBHOOK"], headers={"Accept": "application/json", "Content-Type": "application/json"}, @@ -33,10 +19,10 @@ "content": None, "embeds": [ { - "title": "New Devbuild:", + "title": "New Devbuild!", "description": "", "url": "", - "color": 16734443, + "color": 11761899, "fields": [ { "name": "Changes since last commit:", @@ -44,21 +30,13 @@ }, { "name": "Changes since last release:", - "value": f"[Compare release to {event['after'][:7]}]({event['compare'].rsplit('/', 1)[0] + '/main...' + event['after']})" + "value": f"[Compare release to {event['after'][:7]}]({event['compare'].rsplit('/', 1)[0] + '/release...' + event['after']})" }, { - "name": "Firmware download:", - "value": f"- [Download SDK for development]({dev_share.format(files=os.environ['ARTIFACT_SDK'])})\n- [Download Firmware TGZ]({dev_share.format(files=os.environ['ARTIFACT_TGZ'])})" + "name": "Download artifacts:", + "value": f"- [Download Firmware TGZ]({artifact_tgz})\n- [SDK (for development)]({artifact_sdk})" } ], - "author": { - "name": "Build Succeeded!", - # "icon_url": "" - }, - # "footer": { - # "text": "Build go brrrr", - # "icon_url": "" - # }, "timestamp": dt.datetime.utcnow().isoformat() } ], diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b502ddfaa7..0acd3319ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -82,8 +82,9 @@ jobs: mkdir artifacts cp dist/${TARGET}-*/flipper-z-${TARGET}-{update,sdk}-* artifacts/ cd dist/${TARGET}-*/${TARGET}-update-*/ - artifact="$(basename "$(realpath .)")" - 7z a ../../../artifacts/flipper-z-${artifact}.zip . + ARTIFACT_TAG=flipper-z-"$(basename "$(realpath .)")" + 7z a ../../../artifacts/${ARTIFACT_TAG}.zip . + echo "ARTIFACT_TAG=$ARTIFACT_TAG" >> $GITHUB_ENV - name: "Upload artifacts to update server" if: ${{ !github.event.pull_request.head.repo.fork }} @@ -95,14 +96,10 @@ jobs: ${FILES[@]} \ "${{ secrets.INDEXER_URL }}"/firmware/uploadfiles - # - name: Send devbuild webhook - # if: "github.event_name == 'push' && github.ref_name == 'dev' && !contains(github.event.head_commit.message, '--nobuild')" - # env: - # NC_HOST: "https://cloud.cynthialabs.net/" - # NC_USERAGENT: "${{ secrets.NC_USERAGENT }}" - # NC_USER: "${{ secrets.NC_USER }}" - # NC_PASS: "${{ secrets.NC_PASS }}" - # BUILD_WEBHOOK: ${{ secrets.BUILD_WEBHOOK }} - # run: | - # python -m pip install pyncclient - # python .github/workflow_data/devbuild.py + - name: Send devbuild webhook + if: "github.event_name == 'push' && github.ref_name == 'dev' && !contains(github.event.head_commit.message, '--nobuild')" + env: + INDEXER_URL: ${{ secrets.INDEXER_URL }} + BUILD_WEBHOOK: ${{ secrets.BUILD_WEBHOOK }} + run: | + python .github/workflow_data/devbuild.py