镜像自地址
https://github.com/THZoria/NX_Firmware.git
已同步 2026-04-09 10:41:13 +00:00
Refactor firmware version check and download script
这个提交包含在:
36
.github/workflows/firmware-autodl.yml
vendored
36
.github/workflows/firmware-autodl.yml
vendored
@@ -38,17 +38,20 @@ jobs:
|
|||||||
|
|
||||||
- name: 🔍 Check firmware version (Filter: 21.0.0+)
|
- name: 🔍 Check firmware version (Filter: 21.0.0+)
|
||||||
id: version_check
|
id: version_check
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
RSS_FEED=$(curl -s 'https://yls8.mtheall.com/ninupdates/feed.php')
|
RSS_FEED=$(curl -s https://yls8.mtheall.com/ninupdates/feed.php)
|
||||||
|
|
||||||
LATEST_VERSION=$(echo "$RSS_FEED" | \
|
# Extraction simple sans grep -P
|
||||||
grep -oP '<title>Switch \K[0-9.]+' | \
|
LATEST_VERSION=$(echo "$RSS_FEED" \
|
||||||
grep -E '^([2-9][1-9]|[3-9][0-9])\.' | \
|
| grep "<title>Switch" \
|
||||||
head -n 1)
|
| sed -E 's/.*Switch ([0-9.]+).*/\1/' \
|
||||||
|
| grep -E '^(2[1-9]|[3-9][0-9])\.' \
|
||||||
|
| head -n 1)
|
||||||
|
|
||||||
if [ -z "$LATEST_VERSION" ]; then
|
if [ -z "$LATEST_VERSION" ]; then
|
||||||
echo "INFO: Aucune nouvelle version majeure (>= 21.0.0) détectée."
|
echo "INFO: Aucune nouvelle version majeure (>= 21.0.0) détectée."
|
||||||
echo "new_version=false" >> $GITHUB_OUTPUT
|
echo "new_version=false" >> "$GITHUB_OUTPUT"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -56,25 +59,28 @@ jobs:
|
|||||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION")
|
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION")
|
||||||
|
|
||||||
if [ "$HTTP_STATUS" == "200" ]; then
|
if [ "$HTTP_STATUS" = "200" ]; then
|
||||||
echo "new_version=false" >> $GITHUB_OUTPUT
|
echo "new_version=false" >> "$GITHUB_OUTPUT"
|
||||||
else
|
else
|
||||||
echo "new_version=true" >> $GITHUB_OUTPUT
|
echo "new_version=true" >> "$GITHUB_OUTPUT"
|
||||||
echo "latest_v=$LATEST_VERSION" >> $GITHUB_OUTPUT
|
echo "latest_v=$LATEST_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
shell: bash
|
|
||||||
|
|
||||||
- name: 💻 Execute download script
|
- name: 💻 Execute download script
|
||||||
id: download
|
id: download
|
||||||
if: steps.version_check.outputs.new_version == 'true'
|
if: steps.version_check.outputs.new_version == 'true'
|
||||||
run: |
|
run: |
|
||||||
python3 firmware_downloader.py "${{ steps.version_check.outputs.latest_v }}" | tee firmware_output.txt
|
python3 firmware_downloader.py "${{ steps.version_check.outputs.latest_v }}" | tee firmware_output.txt
|
||||||
FIRMWARE_VERSION=$(grep 'Folder: Firmware ' firmware_output.txt | awk '{print $NF}' || echo "${{ steps.version_check.outputs.latest_v }}")
|
FIRMWARE_VERSION=$(grep 'Firmware_' firmware_output.txt | head -n1 | sed 's/.*Firmware_//')
|
||||||
echo "firmware_version=$FIRMWARE_VERSION" >> $GITHUB_OUTPUT
|
|
||||||
|
if [ -z "$FIRMWARE_VERSION" ]; then
|
||||||
|
FIRMWARE_VERSION="${{ steps.version_check.outputs.latest_v }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "firmware_version=$FIRMWARE_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
# Préparation propre du corps de la release
|
|
||||||
echo "## 🎮 Nintendo Switch Firmware $FIRMWARE_VERSION" > release_notes.md
|
echo "## 🎮 Nintendo Switch Firmware $FIRMWARE_VERSION" > release_notes.md
|
||||||
echo "Téléchargé automatiquement depuis les serveurs officiels." >> release_notes.md
|
echo "Téléchargé automatiquement." >> release_notes.md
|
||||||
echo "### Détails :" >> release_notes.md
|
echo "### Détails :" >> release_notes.md
|
||||||
echo '```text' >> release_notes.md
|
echo '```text' >> release_notes.md
|
||||||
tail -n 15 firmware_output.txt >> release_notes.md
|
tail -n 15 firmware_output.txt >> release_notes.md
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户