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

Commit

Permalink
V50 Release (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jul 27, 2023
2 parents a95edbc + c20d234 commit 8c91fd8
Show file tree
Hide file tree
Showing 1,463 changed files with 34,801 additions and 13,565 deletions.
4 changes: 4 additions & 0 deletions .github/workflow_data/commit.sh
Original file line number Diff line number Diff line change
@@ -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
65 changes: 65 additions & 0 deletions .github/workflow_data/devbuild.py
Original file line number Diff line number Diff line change
@@ -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()
}
],
},
)
5 changes: 3 additions & 2 deletions .github/workflow_data/hotfix.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

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"]:
Expand Down Expand Up @@ -59,7 +60,7 @@

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
)
Expand Down
6 changes: 5 additions & 1 deletion .github/workflow_data/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions .github/workflow_data/release.md
Original file line number Diff line number Diff line change
@@ -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!
Expand Down
11 changes: 10 additions & 1 deletion .github/workflow_data/version.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
#!/bin/bash

export VERSION_TAG="$(python -c 'import fbt_options; print(fbt_options.DIST_SUFFIX)')"
export VERSION_TAG="$(python -c '''
import datetime as dt
import json
import os
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
9 changes: 9 additions & 0 deletions .github/workflow_data/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@

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"
Expand Down
51 changes: 23 additions & 28 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
10 changes: 5 additions & 5 deletions .github/workflows/hotfix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ 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') &&
github.event.review.author_association == 'OWNER' &&
endsWith(github.event.pull_request.title, ' Release') &&
github.event.review.author_association == 'MEMBER' &&
startsWith(github.event.pull_request.title, 'V') &&
github.event.pull_request.base.ref == 'main' &&
github.event.pull_request.head.ref == 'dev' &&
Expand All @@ -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"
Expand Down Expand Up @@ -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 }}
4 changes: 3 additions & 1 deletion .github/workflows/webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ commitnotes.md
fbt_options.py

# Asset packs
assets/dolphin/custom/*
!assets/dolphin/custom/WatchDogs/
!assets/dolphin/custom/ReadMe.md
assets/resources/dolphin_custom/
assets/asset_packs/*
!assets/asset_packs/WatchDogs/
!assets/asset_packs/ReadMe.md
assets/resources/asset_packs/
Loading

0 comments on commit 8c91fd8

Please sign in to comment.