0
0
镜像自地址 https://github.com/THZoria/NX_Firmware.git 已同步 2026-04-09 10:41:13 +00:00

Refactor firmware extraction and version handling

这个提交包含在:
Zoria
2026-03-17 06:52:05 +01:00
提交者 GitHub
父节点 f3d145640b
当前提交 9f2d533eb2

查看文件

@@ -46,38 +46,32 @@ jobs:
exit 0 exit 0
fi fi
# Extraire description Switch (ignore Switch 2) # 🔥 Extraction propre de toutes les versions Switch (ignore Switch 2)
DESCRIPTION=$(echo "$RSS" | grep -oE '<description>Switch [0-9]+\.[0-9]+\.[0-9]+' | \ VERSIONS=$(echo "$RSS" | grep -oE 'Switch [0-9]+\.[0-9]+\.[0-9]+' | \
grep -v 'Switch 2' | \ grep -v 'Switch 2' | \
head -n 1) grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
if [ -z "$DESCRIPTION" ]; then if [ -z "$VERSIONS" ]; then
echo "INFO: Aucun firmware Switch valide trouvé." echo "INFO: Aucun firmware trouvé."
echo "new_version=false" >> $GITHUB_OUTPUT echo "new_version=false" >> $GITHUB_OUTPUT
exit 0 exit 0
fi fi
echo "Description détectée : $DESCRIPTION" # 🔥 Prend la version la plus récente (corrige ton bug)
VERSION=$(printf "%s\n" $VERSIONS | sort -V | tail -n 1)
VERSION=$(echo "$DESCRIPTION" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') echo "Version la plus récente détectée : $VERSION"
if [ -z "$VERSION" ]; then
echo "INFO: Impossible d'extraire la version."
echo "new_version=false" >> $GITHUB_OUTPUT
exit 0
fi
MAJOR=$(echo "$VERSION" | cut -d. -f1) MAJOR=$(echo "$VERSION" | cut -d. -f1)
# Autorise uniquement 21+ # 🔒 Ignore < 21.x
if [ "$MAJOR" -lt 21 ]; then if [ "$MAJOR" -lt 21 ]; then
echo "INFO: Firmware $VERSION ignoré (<21.x)." echo "INFO: Firmware $VERSION ignoré (<21.x)."
echo "new_version=false" >> $GITHUB_OUTPUT echo "new_version=false" >> $GITHUB_OUTPUT
exit 0 exit 0
fi fi
echo "Version valide détectée : $VERSION" # 🔎 Vérifie si release déjà existante
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$VERSION") "https://api.github.com/repos/${{ github.repository }}/releases/tags/$VERSION")