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

比较提交

...

11 次代码提交

作者 SHA1 备注 提交日期
Zoria
cd09390cd5 Refactor firmware version check and download process 2026-03-17 07:11:08 +01:00
Zoria
df02467cdd Improve firmware download workflow and messages
Refactor firmware download workflow for clarity and accuracy.
2026-03-17 07:06:25 +01:00
Zoria
a3b5ff8eea Refactor firmware autodl workflow for improved checks 2026-03-17 07:04:25 +01:00
Zoria
bf849d454d Add lxml to Python module installation 2026-03-17 07:01:41 +01:00
Zoria
e5cac716b8 Refactor firmware autodl workflow for better handling
Updated the firmware autodl workflow to improve Python script and file handling.
2026-03-17 07:00:35 +01:00
Zoria
9f2d533eb2 Refactor firmware extraction and version handling 2026-03-17 06:52:05 +01:00
Zoria
f3d145640b Fix firmware version check and update logic 2026-02-22 00:28:25 +01:00
Zoria
acb5f7b500 Update firmware autodl workflow for version checks 2026-02-22 00:26:09 +01:00
Zoria
c368de2568 Refactor firmware version check and download script 2026-02-22 00:23:44 +01:00
Zoria
5dfb4b0301 Enhance firmware auto downloader workflow
Updated the firmware auto downloader workflow to improve release notes preparation and streamline version checking.
2026-02-22 00:22:38 +01:00
Zoria
e53232cb55 Update firmware auto downloader workflow to v21.0.0
Updated the firmware auto downloader workflow to include version 21.0.0, added new dependencies, and improved error handling.
2026-02-22 00:21:57 +01:00

查看文件

@@ -17,7 +17,7 @@ jobs:
with:
fetch-depth: 0
- name: 🐍 Setup Python and dependencies
- name: 🐍 Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
@@ -28,71 +28,89 @@ jobs:
- name: ⬇️ Setup hactool-linux
run: |
cp hactool-linux hactool
chmod +x hactool
if [ -f "hactool-linux" ]; then
cp hactool-linux hactool
chmod +x hactool
else
echo "Warning: hactool-linux non trouvé."
fi
- name: 🔍 Check firmware version (Switch 1 only, 21.0.0+)
- name: 🔍 Check firmware version (Switch 1 only, >=21.0.0)
id: version_check
shell: bash
run: |
LATEST_TITLE=$(curl -s 'https://yls8.mtheall.com/ninupdates/feed.php' | \
grep '<title>Switch ' | \
grep -v '<title>Switch 2 ' | \
grep -E 'Switch ([2-9][1-9]|[3-9][0-9])\.' | \
head -n 1)
LATEST_VERSION=$(echo "$LATEST_TITLE" | grep -oP 'Switch \K[0-9.]+')
if [ -z "$LATEST_VERSION" ]; then
echo "INFO: Aucune version récente (>= 21.x) trouvée."
set +e
RSS=$(curl -sL --fail https://yls8.mtheall.com/ninupdates/feed.php)
if [ $? -ne 0 ] || [ -z "$RSS" ]; then
echo "new_version=false" >> $GITHUB_OUTPUT
exit 0
fi
echo "Version détectée : $LATEST_VERSION"
# Extraction stricte Switch 1 (hac) + Tri version
LATEST_VERSION=$(echo "$RSS" | tr -d '\n' | sed 's/<item>/\n<item>/g' | \
grep 'sys=hac' | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | sort -V | tail -n 1)
if [ -z "$LATEST_VERSION" ]; then
echo "new_version=false" >> $GITHUB_OUTPUT
exit 0
fi
MAJOR=$(echo "$LATEST_VERSION" | cut -d. -f1)
if [ "$MAJOR" -lt 21 ]; then
echo "new_version=false" >> $GITHUB_OUTPUT
exit 0
fi
# Check si la Release existe
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$LATEST_VERSION")
if [ "$HTTP_STATUS" == "200" ]; then
echo "INFO: La release $LATEST_VERSION existe déjà."
if [ "$HTTP_STATUS" = "200" ]; then
echo "new_version=false" >> $GITHUB_OUTPUT
else
echo "INFO: Nouvelle version $LATEST_VERSION détectée !"
echo "new_version=true" >> $GITHUB_OUTPUT
echo "firmware_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
fi
shell: bash
set -e
- name: 💻 Execute download script and capture changelog
- name: 💻 Execute download script
id: download
if: steps.version_check.outputs.new_version == 'true'
run: |
python3 firmware_downloader.py | tee firmware_output.txt
FIRMWARE_VERSION=$(grep 'Folder: Firmware ' firmware_output.txt | awk '{print $NF}')
echo "firmware_version=$FIRMWARE_VERSION" >> $GITHUB_OUTPUT
tail -n 4 firmware_output.txt > changelog_body.txt
python3 firmware_downloader.py
VERSION="${{ steps.version_check.outputs.firmware_version }}"
echo "firmware_version=$VERSION" >> $GITHUB_OUTPUT
- name: 🧹 Clean .nca files
- name: 🧹 Clean and Generate Changelog
id: cleanup
if: steps.version_check.outputs.new_version == 'true'
run: |
find . -type f -name "*.nca.*" -delete
VERSION="${{ steps.download.outputs.firmware_version }}"
if [ -d "Firmware $VERSION" ]; then
rm -f "Firmware $VERSION.zip"
zip -rj "Firmware $VERSION.zip" "Firmware $VERSION/" -i "*.nca"
fi
DIR="Firmware $VERSION"
- name: 📝 Prepare Release Body
id: prepare_body
if: steps.version_check.outputs.new_version == 'true'
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
if (fs.existsSync('changelog_body.txt')) {
const changelogBody = fs.readFileSync('changelog_body.txt', 'utf8');
core.setOutput('release_body', changelogBody);
}
if [ -d "$DIR" ]; then
# Suppression des fichiers .1.nca et fragments
find "$DIR" -type f -name "*.[0-9].nca" -delete
find "$DIR" -type f -name "*.nca.*" -delete
# Extraction des SystemVersion NCA (fichiers de ~128KB)
# On cherche les fichiers NCA et on les trie par taille pour identifier les SystemVersion
SV_FAT=$(ls -S "$DIR"/*.nca | tail -n 2 | head -n 1 | xargs basename)
SV_EXFAT=$(ls -S "$DIR"/*.nca | tail -n 1 | xargs basename)
# Création du changelog personnalisé
echo "Archive created: Firmware $VERSION.zip" > changelog_body.txt
echo "SystemVersion NCA FAT: $SV_FAT" >> changelog_body.txt
echo "SystemVersion NCA exFAT: $SV_EXFAT" >> changelog_body.txt
echo "Verify hashes before installation!" >> changelog_body.txt
# Compression
zip -rj "Firmware $VERSION.zip" "$DIR/" -i "*.nca"
else
echo "Dossier non trouvé"
exit 1
fi
- name: 📦 Create Tag and Release
if: steps.version_check.outputs.new_version == 'true'
@@ -103,12 +121,10 @@ jobs:
body: |
Automatic download of the official Nintendo Switch firmware version **${{ steps.download.outputs.firmware_version }}**.
---
**Downloaded file details:**
${{ steps.prepare_body.outputs.release_body }}
```text
$(cat changelog_body.txt)
```
files: |
Firmware ${{ steps.download.outputs.firmware_version }}.zip
env: