diff --git a/.github/workflow_data/commit.sh b/.github/workflow_data/commit.sh new file mode 100644 index 000000000..ddfe7040f --- /dev/null +++ b/.github/workflow_data/commit.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +export VERSION_TAG="$(python -c 'import fbt_options; print(fbt_options.DIST_SUFFIX, end="")')" +echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV diff --git a/.github/workflow_data/devbuild.py b/.github/workflow_data/devbuild.py new file mode 100644 index 000000000..fd409bce2 --- /dev/null +++ b/.github/workflow_data/devbuild.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +import nextcloud_client +import datetime as dt +import requests +import json +import os + +dev_share = os.environ["NC_HOST"] + "s/sGHsQB94a9x5CRs/download?path=/&files={files}" + +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"XFW-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"}, + json={ + "content": None, + "embeds": [ + { + "title": "Devbuild infos:", + "description": "", + "url": "", + "color": 16734443, + "fields": [ + { + "name": "Changes since last commit:", + "value": f"[Compare {event['before'][:7]} to {event['after'][:7]}]({event['compare']})" + }, + { + "name": "Changes since last release:", + "value": f"[Compare release to {event['after'][:7]}]({event['compare'].rsplit('/', 1)[0] + '/main...' + 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'])})" + } + ], + "author": { + "name": "Build Succeeded!", + "icon_url": "https://cdn.discordapp.com/emojis/1080005692485795930.png" + }, + "footer": { + "text": "Build go brrrr", + "icon_url": "https://cdn.discordapp.com/emojis/1059798228725403719.png" + }, + "timestamp": dt.datetime.utcnow().isoformat() + } + ], + }, + ) diff --git a/.github/workflow_data/hotfix.py b/.github/workflow_data/hotfix.py index 5d09d9f9c..91a60868f 100644 --- a/.github/workflow_data/hotfix.py +++ b/.github/workflow_data/hotfix.py @@ -21,7 +21,8 @@ if __name__ == "__main__": artifacts = { os.environ['ARTIFACT_TGZ']: "application/gzip", - os.environ['ARTIFACT_ZIP']: "application/zip" + os.environ['ARTIFACT_ZIP']: "application/zip", + os.environ['ARTIFACT_SDK']: "application/zip", } for asset in release["assets"]: @@ -59,7 +60,7 @@ if __name__ == "__main__": body = release["body"] body = re.sub( - r"(https://github\.com/ClaraCrazy/Flipper-Xtreme/releases/download/[A-Za-z0-9_-]+?/)[A-Za-z0-9_-]+", + r"(https://github\.com/Flipper-XFW/Xtreme-Firmware/releases/download/[A-Za-z0-9_-]+?/)[A-Za-z0-9_-]+", r"\1" + os.environ['VERSION_TAG'], body ) diff --git a/.github/workflow_data/package.sh b/.github/workflow_data/package.sh index 8ee999543..02fa15b48 100644 --- a/.github/workflow_data/package.sh +++ b/.github/workflow_data/package.sh @@ -3,12 +3,16 @@ export ARTIFACT_DIR="${VERSION_TAG}" export ARTIFACT_TGZ="${VERSION_TAG}.tgz" export ARTIFACT_ZIP="${VERSION_TAG}.zip" +export ARTIFACT_SDK="${VERSION_TAG}-sdk.zip" cd dist/${DEFAULT_TARGET}-* mv ${DEFAULT_TARGET}-update-* ${ARTIFACT_DIR} tar --format=ustar -czvf ../../${ARTIFACT_TGZ} ${ARTIFACT_DIR} cd ${ARTIFACT_DIR} 7z a ../../../${ARTIFACT_ZIP} . -cd ../../.. +cd .. +mv flipper-z-${DEFAULT_TARGET}-sdk-*.zip ../../${ARTIFACT_SDK} +cd ../.. echo "ARTIFACT_TGZ=${ARTIFACT_TGZ}" >> $GITHUB_ENV echo "ARTIFACT_ZIP=${ARTIFACT_ZIP}" >> $GITHUB_ENV +echo "ARTIFACT_SDK=${ARTIFACT_SDK}" >> $GITHUB_ENV diff --git a/.github/workflow_data/release.md b/.github/workflow_data/release.md index 7128cb454..f3fdab973 100644 --- a/.github/workflow_data/release.md +++ b/.github/workflow_data/release.md @@ -1,11 +1,11 @@ ## ⬇️ Download >### [🖥️ Web Updater (chrome)](https://flipper-xtre.me/update) [recommended] ->### [🐬 qFlipper Package (.tgz)](https://github.com/ClaraCrazy/Flipper-Xtreme/releases/download/{VERSION_TAG}/{ARTIFACT_TGZ}) +>### [🐬 qFlipper Package (.tgz)](https://github.com/Flipper-XFW/Xtreme-Firmware/releases/download/{VERSION_TAG}/{ARTIFACT_TGZ}) ->### [📦 Zipped Archive (.zip)](https://github.com/ClaraCrazy/Flipper-Xtreme/releases/download/{VERSION_TAG}/{ARTIFACT_ZIP}) +>### [📦 Zipped Archive (.zip)](https://github.com/Flipper-XFW/Xtreme-Firmware/releases/download/{VERSION_TAG}/{ARTIFACT_ZIP}) -**Check the [install guide](https://github.com/ClaraCrazy/Flipper-Xtreme#install) if you're not sure, or [join our Discord](https://discord.gg/flipper-xtreme) if you have questions or encounter issues!** +**Check the [install guide](https://github.com/Flipper-XFW/Xtreme-Firmware#install) if you're not sure, or [join our Discord](https://discord.gg/flipper-xtreme) if you have questions or encounter issues!** ## ❤️ Support If you like what you're seeing, **please consider donating to us**. We won't ever put this behind a paywall, but we'd still appreciate a few bucks! diff --git a/.github/workflow_data/version.sh b/.github/workflow_data/version.sh index b2ba35187..955a78167 100644 --- a/.github/workflow_data/version.sh +++ b/.github/workflow_data/version.sh @@ -1,4 +1,11 @@ #!/bin/bash -export VERSION_TAG="$(python -c 'import fbt_options; print(fbt_options.DIST_SUFFIX)')" +export VERSION_TAG="$(python -c ''' +import datetime as dt +with open(os.environ["GITHUB_EVENT_PATH"], "r") as f: + event = json.load(f) +version = int(event["pull_request"]["title"].removeprefix("V").removesuffix(" Release").removesuffix(" Hotfix")) +date = dt.datetime.now().strftime("%d%m%Y") +print(f"XFW-{version:04}_{date}", end="") +''')" echo "VERSION_TAG=${VERSION_TAG}" >> $GITHUB_ENV diff --git a/.github/workflow_data/webhook.py b/.github/workflow_data/webhook.py index 08eab46fb..d1f9c08bb 100644 --- a/.github/workflow_data/webhook.py +++ b/.github/workflow_data/webhook.py @@ -16,7 +16,16 @@ if __name__ == "__main__": match os.environ["GITHUB_EVENT_NAME"]: case "push": + webhook = "BUILD_WEBHOOK" count = len(event["commits"]) + if count == 20: + count = int(requests.get( + event["compare"].replace("github.com", "api.github.com/repos"), + headers={ + "Accept": "application/vnd.github.v3+json", + "Authorization": f"token {os.environ['GITHUB_TOKEN']}" + } + ).json()["total_commits"]) branch = event["ref"].removeprefix("refs/heads/") change = ( "Force Push" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 038954256..37515be68 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,6 +9,10 @@ on: - '*' pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + env: TARGETS: f7 DEFAULT_TARGET: f7 @@ -24,47 +28,38 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} + - name: "Read version tag" + run: bash .github/workflow_data/commit.sh + - name: 'Build the firmware' run: | set -e for TARGET in ${TARGETS}; do TARGET_HW="$(echo "${TARGET}" | sed 's/f//')"; \ - ./fbt TARGET_HW=$TARGET_HW updater_package + ./fbt TARGET_HW=$TARGET_HW DIST_SUFFIX=$VERSION_TAG updater_package done - name: "Check for uncommitted changes" run: | git diff --exit-code - - name: 'Updater artifact' + - name: 'Dist artifact' uses: actions/upload-artifact@v3 with: - name: updater + name: dist path: | - dist/${{ env.DEFAULT_TARGET }}-*/${{ env.DEFAULT_TARGET }}-update-*/ + dist/${{ env.DEFAULT_TARGET }}-*/ - # - name: 'Find Previous Comment' - # if: ${{ github.event.pull_request }} - # uses: peter-evans/find-comment@v1 - # id: fc - # with: - # issue-number: ${{ github.event.pull_request.number }} - # comment-author: 'github-actions[bot]' - # body-includes: 'Compiled firmware:' + - name: "Make tgz, zip and sdk" + run: bash .github/workflow_data/package.sh - # - name: Artifact info - # id: artifact-info - # uses: dawidd6/action-download-artifact@v2 - # with: - # dry_run: true - - # - name: 'Create or update comment' - # if: ${{ github.event.pull_request}} - # uses: peter-evans/create-or-update-comment@v1 - # with: - # comment-id: ${{ steps.fc.outputs.comment-id }} - # issue-number: ${{ github.event.pull_request.number }} - # body: | - # **Compiled firmware:** - # - [📦 Update package](${{steps.artifact-info.outputs.artifacts[0].archive_download_url}}) - # edit-mode: replace + - name: Send devbuild webhook + if: "github.event_name == 'push' && github.ref_name == 'dev'" + env: + NC_HOST: "https://cloud.cynthialabs.net/" + 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 diff --git a/.github/workflows/hotfix.yml b/.github/workflows/hotfix.yml index d8430d396..38076ae18 100644 --- a/.github/workflows/hotfix.yml +++ b/.github/workflows/hotfix.yml @@ -31,22 +31,22 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} + - name: "Read version tag" + run: bash .github/workflow_data/version.sh + - name: 'Build the firmware' run: | set -e for TARGET in ${TARGETS}; do TARGET_HW="$(echo "${TARGET}" | sed 's/f//')"; \ - ./fbt TARGET_HW=$TARGET_HW FORCE_NO_DIRTY=1 updater_package + ./fbt TARGET_HW=$TARGET_HW DIST_SUFFIX=$VERSION_TAG FORCE_NO_DIRTY=1 updater_package done - name: "Check for uncommitted changes" run: | git diff --exit-code - - name: "Read version tag" - run: bash .github/workflow_data/version.sh - - - name: "Make tgz and zip" + - name: "Make tgz, zip and sdk" run: bash .github/workflow_data/package.sh - name: "Upload hotfix" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0fce2a019..47c103807 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -12,7 +12,7 @@ jobs: release: if: | github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name && - endsWith(github.event.pull_request.title, ' Release Candidate Changes') && + endsWith(github.event.pull_request.title, ' Release') && github.event.review.author_association == 'OWNER' && startsWith(github.event.pull_request.title, 'V') && github.event.pull_request.base.ref == 'main' && @@ -31,22 +31,22 @@ jobs: fetch-depth: 0 ref: ${{ github.event.pull_request.head.sha }} + - name: "Read version tag" + run: bash .github/workflow_data/version.sh + - name: 'Build the firmware' run: | set -e for TARGET in ${TARGETS}; do TARGET_HW="$(echo "${TARGET}" | sed 's/f//')"; \ - ./fbt TARGET_HW=$TARGET_HW FORCE_NO_DIRTY=1 updater_package + ./fbt TARGET_HW=$TARGET_HW DIST_SUFFIX=$VERSION_TAG FORCE_NO_DIRTY=1 updater_package done - name: "Check for uncommitted changes" run: | git diff --exit-code - - name: "Read version tag" - run: bash .github/workflow_data/version.sh - - - name: "Make tgz and zip" + - name: "Make tgz, zip and sdk" run: bash .github/workflow_data/package.sh - name: "Update release notes" @@ -76,6 +76,7 @@ jobs: files: | ${{ env.ARTIFACT_TGZ }} ${{ env.ARTIFACT_ZIP }} + ${{ env.ARTIFACT_SDK }} name: "${{ env.VERSION_TAG }}" tag_name: "${{ env.VERSION_TAG }}" target_commitish: ${{ github.event.pull_request.base.ref }} diff --git a/.github/workflows/webhook.yml b/.github/workflows/webhook.yml index a4e380467..2b60a2532 100644 --- a/.github/workflows/webhook.yml +++ b/.github/workflows/webhook.yml @@ -39,5 +39,7 @@ jobs: - name: Send webhook env: - DEV_WEBHOOK: "https://discord.com/api/webhooks/${{ secrets.DEV_WEBHOOK_ID }}/${{ secrets.DEV_WEBHOOK_TOKEN }}" + BUILD_WEBHOOK: ${{ secrets.BUILD_WEBHOOK }} + DEV_WEBHOOK: ${{ secrets.DEV_WEBHOOK }} + GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" run: python .github/workflow_data/webhook.py diff --git a/.vscode/example/tasks.json b/.vscode/example/tasks.json index f2522668d..1d2b55a2c 100644 --- a/.vscode/example/tasks.json +++ b/.vscode/example/tasks.json @@ -4,17 +4,29 @@ "version": "2.0.0", "tasks": [ { - "label": "[Release] Build", + "label": "[Release] Build Firmware", "group": "build", "type": "shell", "command": "./fbt COMPACT=1 DEBUG=0" }, { - "label": "[Debug] Build", + "label": "[Debug] Build Firmware", "group": "build", "type": "shell", "command": "./fbt" }, + { + "label": "[FBT] Format", + "group": "build", + "type": "shell", + "command": "./fbt format" + }, + { + "label": "[FBT] Clear", + "group": "build", + "type": "shell", + "command": "./fbt -c" + }, { "label": "[Release] Flash (ST-Link)", "group": "build", @@ -123,17 +135,29 @@ "type": "shell", "command": "./fbt COMPACT=1 DEBUG=0 fap_dist" }, + { + "label": "[Debug] Build App", + "group": "build", + "type": "shell", + "command": "./fbt build APPSRC=${relativeFileDirname}" + }, + { + "label": "[Release] Build App", + "group": "build", + "type": "shell", + "command": "./fbt COMPACT=1 DEBUG=0 build APPSRC=${relativeFileDirname}" + }, { "label": "[Debug] Launch App on Flipper", "group": "build", "type": "shell", - "command": "./fbt launch_app APPSRC=${relativeFileDirname}" + "command": "./fbt launch APPSRC=${relativeFileDirname}" }, { "label": "[Release] Launch App on Flipper", "group": "build", "type": "shell", - "command": "./fbt COMPACT=1 DEBUG=0 launch_app APPSRC=${relativeFileDirname}" + "command": "./fbt COMPACT=1 DEBUG=0 launch APPSRC=${relativeFileDirname}" }, { "label": "[Debug] Launch App on Flipper with Serial Console", @@ -148,13 +172,13 @@ "label": "[Debug] Build and upload all FAPs to Flipper over USB", "group": "build", "type": "shell", - "command": "./fbt faps_copy" + "command": "./fbt fap_deploy" }, { "label": "[Release] Build and upload all FAPs to Flipper over USB", "group": "build", "type": "shell", - "command": "./fbt COMPACT=1 DEBUG=0 faps_copy" + "command": "./fbt COMPACT=1 DEBUG=0 fap_deploy" }, { // Press Ctrl+] to quit @@ -163,7 +187,7 @@ "command": "./fbt cli", "group": "none", "isBackground": true, - "options": { + "options": { "env": { "FBT_NO_SYNC": "0" } diff --git a/ReadMe.md b/ReadMe.md index 2da02b530..1722a2d70 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,11 +1,11 @@

XFW - Xtreme Firmware for the Flipper Zero

- +

- Website | Intro | Install | Changelog | Wiki | Discord | Donate + Website | Intro | Install | Changelog | Wiki | Discord | Donate

This firmware is a complete overhaul of the [Official Firmware](https://github.com/flipperdevices/flipperzero-firmware), and also features lots of awesome code-bits from [Unleashed](https://github.com/DarkFlippers/unleashed-firmware). @@ -24,7 +24,7 @@ The goal of this Firmware is to regularly bring out amazing updates based on wha -

Customizable: Dont like the Animations, want to turn on/off the Home screen icons (battery, SD card etc), change the flippers name or anything like that? You absolutely can. No need to mess with code or deal with weird manifest files. Its all done with an App.



-Note, the below mentioned changes are only a few things we did. For a full list click [here](https://github.com/ClaraCrazy/Flipper-Xtreme/wiki/Customization) +Note, the below mentioned changes are only a few things we did. For a full list click [here](https://github.com/Flipper-XFW/Xtreme-Firmware/wiki/Customization) -----
@@ -44,7 +44,7 @@ Also, perhaps a bigger height, with set width (yes distrotion issues ik) so it f - Interface: Customize every bit of your Flipper, from the desktop animations, to the main menu apps, lockscreen style etc. -- Protocols: Here you can toggle between USB & Bluetooth mode for BadKB, and manage custom Subghz frequencies. +- Protocols: Here you can toggle between USB & Bluetooth mode for BadKB, and manage custom Subghz frequencies. - Misc: All the other options that don't fit elsewhere. Change your Flipper's name, xp level, and configure the RGB backlight. @@ -60,7 +60,7 @@ Also, perhaps a bigger height, with set width (yes distrotion issues ik) so it f We created our own, new & improved Animation / Asset system, that we can finally reveal. It lets you to create and cycle through your own `Asset Packs` with only a few button presses, allowing you to easily load custom Animations and Icons like never before. -You can easily create your own pack, or find some user made ones in the discord channel. Check here for a tutorial on creating your own. Essentially, we got our own Anims & Icons folders, inside each Asset Pack. +You can easily create your own pack, or find some user made ones in the discord channel. Check here for a tutorial on creating your own. Essentially, we got our own Anims & Icons folders, inside each Asset Pack.
@@ -160,21 +160,21 @@ There are 3 methods to install Xtreme, we recommend you use the **Web Updater**,
>
Web Updater (Chrome)
>
qFlipper Package (.tgz)
>
Zipped Archive (.zip)