mirror of
https://github.com/UberGuidoZ/Flipper.git
synced 2026-09-18 15:41:30 +00:00
Added QR Code source (thanks bmatcuk!)
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
set -Exeuo pipefail
|
||||
|
||||
print_status() {
|
||||
local level="$1"
|
||||
local body="${2//%/%25}"
|
||||
body="${body//$'\r'/}"
|
||||
body="${body//$'\n'/%0A}"
|
||||
|
||||
echo "::$level::$body"
|
||||
}
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P)"
|
||||
FIRMWARE_DIR="$1"
|
||||
|
||||
LASTVER="$(git -C "$SCRIPT_DIR" tag | grep firmware-v | sort -V | tail -n1 | sed -e 's/^firmware-v//')"
|
||||
print_status notice "last built against firmware version: $LASTVER"
|
||||
|
||||
VER="$(git -C "$FIRMWARE_DIR" tag | sed -E -e '/^[0-9]+\.[0-9]+\.[0-9]+$/!d' | sort -V | sed -e "1,/$LASTVER/d" | tail -n1)"
|
||||
# VER="$(curl https://api.github.com/repos/flipperdevices/flipperzero-firmware/tags | jq -r --arg current "$LASTVER" 'def ver($v): $v | ltrimstr("v") | split(".") | map(tonumber); map(.name) | map(select(. | test("^\\d+\\.\\d+\\.\\d+$";"s"))) | map(ver(.)) | map(select(. > ver($current))) | sort | last | if . == null then "" else join(".") end')"
|
||||
if [ -z "$VER" ]; then
|
||||
print_status notice "no new firmware version"
|
||||
exit 0
|
||||
fi
|
||||
print_status notice "new firmware version: $VER"
|
||||
echo "::set-output name=version::$VER"
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
#!/bin/bash
|
||||
set -Exeuo pipefail
|
||||
|
||||
print_status() {
|
||||
local level="$1"
|
||||
local body="${2//%/%25}"
|
||||
body="${body//$'\r'/}"
|
||||
body="${body//$'\n'/%0A}"
|
||||
|
||||
echo "::$level::$body"
|
||||
}
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd -P)"
|
||||
FIRMWARE_VER="$1"
|
||||
|
||||
pushd "$(git -C "$SCRIPT_DIR" rev-parse --show-toplevel)"
|
||||
print_status notice "updating to firmware $FIRMWARE_VER"
|
||||
|
||||
# setup git
|
||||
git config --local user.name $GIT_USER_NAME
|
||||
git config --local user.email $GIT_USER_EMAIL
|
||||
|
||||
# construct a new version number for the qrcode app
|
||||
VER="$(git tag | sed -E -e '/^v[0-9]+\.[0-9]+\.[0-9]+$/!d' | sort -V | tail -n1)"
|
||||
if [[ "$VER" =~ ^(v[0-9]+.[0-9]+).([0-9]+)$ ]]; then
|
||||
VER="${BASH_REMATCH[1]}.$(( ${BASH_REMATCH[2]} + 1 ))"
|
||||
else
|
||||
print_status warning "couldn't construct new version number from $VER"
|
||||
exit 1
|
||||
fi
|
||||
print_status notice "new qrcode version: $VER"
|
||||
|
||||
# update firmware version in automation
|
||||
sed -i -e "/firmware_version:/s/'.*'/'$FIRMWARE_VER'/" .github/workflows/release.yml
|
||||
|
||||
# commit and tag
|
||||
git add .github/workflows/release.yml
|
||||
git commit -m "update to firmware $FIRMWARE_VER"
|
||||
git tag -a -m "$VER" "$VER"
|
||||
git tag "firmware-v$FIRMWARE_VER"
|
||||
git push --all
|
||||
|
||||
popd
|
||||
Reference in New Issue
Block a user