mirror of
https://github.com/MiyooCFW/buildroot.git
synced 2025-09-27 22:24:19 +03:00
GENIMAGE/ACTIONS: automate CFW release tag & status ver. (#94)
* [GENIMAGE] automate CFW release tag & status ver. - shell formatting - add CFW_ITERATION count for Dev-build - separate CFW and BR2 tagging - don't use $BR2_VERSION_FULL * [ACTIONS] build.yml: - allow for manual workflow dispatch - fetch-depth=0 (can't fetch-tags) - rm commented line - cleanup - append `ref_name` for unofficials
This commit is contained in:
@@ -1,22 +1,69 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
CFW_RELEASE="2.0.0"
|
||||
STATUS="BETAv2"
|
||||
|
||||
BR2_VENDOR=${2}
|
||||
BR2_VERSION_FULL=${3}
|
||||
LIBC=${4}
|
||||
export IMAGE_NAME="${BR2_VENDOR}-cfw-${CFW_RELEASE}${BR2_VERSION_FULL}_${LIBC}-${STATUS}${APPEND_VERSION}.img"
|
||||
STARTDIR=`pwd`
|
||||
SELFDIR=`dirname \`realpath ${0}\``
|
||||
STARTDIR=$(pwd)
|
||||
SELFDIR=$(dirname $(realpath ${0}))
|
||||
|
||||
# Generate CFW release tag, status and append iteration count
|
||||
if test $(git tag | wc -l) -ne 0; then
|
||||
BR2_TAG="$(git describe --tags --abbrev=0)"
|
||||
BR2_ITERATION="$(git rev-list --count ${BR2_TAG}..HEAD)"
|
||||
fi
|
||||
|
||||
BR2_HASH="$(git rev-parse --short HEAD)" # not using print-version from BR2_VERSION_FULL
|
||||
if (test "$CFW_HASH" == "$BR2_HASH" || test -z "$CFW_HASH"); then
|
||||
CFW_TYPE="br2_dist"
|
||||
CFW_HASH="$BR2_HASH"
|
||||
CFW_VERSION="BR2=${BR2_HASH}"
|
||||
GIT_TAG="$BR2_TAG"
|
||||
ITERATION_VERSION="$BR2_ITERATION"
|
||||
else
|
||||
CFW_TYPE="cfw"
|
||||
CFW_VERSION="CFW=${CFW_HASH}"
|
||||
GIT_TAG="$CFW_TAG"
|
||||
ITERATION_VERSION="$CFW_ITERATION"
|
||||
fi
|
||||
|
||||
if test -n "$GIT_TAG"; then
|
||||
CFW_RELEASE="$(echo ${GIT_TAG} | sed 's/-.*//')"
|
||||
STATUS="$(echo ${GIT_TAG} | sed 's/^[^-]*-//' | tr '[:lower:]' '[:upper:]' | tr '-' 'v')"
|
||||
if test $ITERATION_VERSION -eq 0; then
|
||||
APPEND_VERSION=""
|
||||
if test "$STATUS" == "$CFW_RELEASE"; then STATUS="STABLE"; fi
|
||||
else
|
||||
if [[ "$(echo ${STATUS} | sed 's/^[^-]*v//')" =~ ^-?[0-9]+$ ]]; then
|
||||
APPEND_VERSION="v$(echo ${STATUS} | sed 's/^[^-]*v//' | expr $(cat -) + 1)${APPEND_VERSION}"
|
||||
STATUS="$(echo ${STATUS} | sed 's/v.*//')"
|
||||
elif test -n "$STATUS" ; then
|
||||
STATUS="${STATUS}v2"
|
||||
fi
|
||||
if test "$STATUS" == "$CFW_RELEASE"; then
|
||||
STATUS="BETA"
|
||||
CFW_RELEASE="$(echo ${CFW_RELEASE} | sed 's/[0-9]$//')$(echo ${CFW_RELEASE} | grep -oE '[0-9]+$' | expr $(cat -) + 1)"
|
||||
fi
|
||||
APPEND_VERSION="${APPEND_VERSION}-n${ITERATION_VERSION}"
|
||||
fi
|
||||
else
|
||||
CFW_RELEASE="0.0.0"
|
||||
STATUS="UNKNOWN"
|
||||
fi
|
||||
|
||||
export IMAGE_NAME="${BR2_VENDOR}-${CFW_TYPE}-${CFW_RELEASE}-${CFW_HASH}_${LIBC}-${STATUS}${APPEND_VERSION}.img"
|
||||
|
||||
# Relocate board files for genimage-sdcard config to read (see last cmd)
|
||||
cp -r board/miyoo/boot "${BINARIES_DIR}"
|
||||
cp -r board/miyoo/main "${BINARIES_DIR}"
|
||||
|
||||
# Write CFW version to splash image
|
||||
convert board/miyoo/miyoo-splash.png -pointsize 12 -fill white -annotate +10+230 "v${CFW_RELEASE} ${CFW_VERSION} (${LIBC}) ${STATUS}${APPEND_VERSION}" -type Palette -colors 224 -depth 8 -compress none -verbose BMP3:"${BINARIES_DIR}"/boot/miyoo-splash.bmp
|
||||
|
||||
# Workaround for build apss and configs being placed in /usr/ after img generation (as we use MAIN)
|
||||
test -d "${BINARIES_DIR}/gmenu2x" && cp -r "${BINARIES_DIR}/gmenu2x/" "${BINARIES_DIR}/main/"
|
||||
test -d "${BINARIES_DIR}/emus" && cp -r "${BINARIES_DIR}/emus/" "${BINARIES_DIR}/main/"
|
||||
if test -d "${BINARIES_DIR}/retroarch";then
|
||||
if test -d "${BINARIES_DIR}/retroarch"; then
|
||||
rsync -avzh "${BINARIES_DIR}/retroarch/" "${BINARIES_DIR}/main/.retroarch/"
|
||||
## Generate list of cores to be used
|
||||
CORES_DIR="${BINARIES_DIR}/retroarch/cores"
|
||||
@@ -26,7 +73,7 @@ if test -d "${BINARIES_DIR}/retroarch";then
|
||||
CORE_FILE="$(echo "$file" | sed 's/.*\///')"
|
||||
CORE_NAME="$(echo "${CORE_FILE}" | sed 's/_libretro.so//g')"
|
||||
CORE_SCRIPT="${CORE_NAME}.sh"
|
||||
touch $RA_WDIR/"${CORE_SCRIPT}"
|
||||
touch $RA_WDIR/"${CORE_SCRIPT}"
|
||||
echo -e "#!/bin/sh\n/mnt/emus/retroarch/retroarch -L ${CORE_FILE} \"\$1\"" > $RA_WDIR/"${CORE_SCRIPT}"
|
||||
chmod +x $RA_WDIR/"${CORE_SCRIPT}"
|
||||
# RA_LDIR="${BINARIES_DIR}/main/gmenu2x/sections/cores"
|
||||
@@ -37,17 +84,6 @@ if test -d "${BINARIES_DIR}/retroarch";then
|
||||
done
|
||||
fi
|
||||
|
||||
# BR2 Version is tracked by git
|
||||
BR2_HASH=$(echo $BR2_VERSION_FULL | sed 's/^[-]g//')
|
||||
if (test "$CFW_HASH" == "$BR2_HASH" || test -z "$CFW_HASH"); then
|
||||
CFW_VERSION="BR2=${BR2_HASH}"
|
||||
else
|
||||
CFW_VERSION="CFW=${CFW_HASH}"
|
||||
fi
|
||||
|
||||
# Write CFW version to splash image
|
||||
convert board/miyoo/miyoo-splash.png -pointsize 12 -fill white -annotate +10+230 "v${CFW_RELEASE} ${CFW_VERSION} (${LIBC}) ${STATUS}${APPEND_VERSION}" -type Palette -colors 224 -depth 8 -compress none -verbose BMP3:"${BINARIES_DIR}"/boot/miyoo-splash.bmp
|
||||
|
||||
# Generate MAIN BTRFS partition
|
||||
image="${BINARIES_DIR}/main.img"
|
||||
label="MAIN"
|
||||
|
||||
Reference in New Issue
Block a user