name: ๐ŸŽฎ Firmware Auto Downloader on: schedule: - cron: '0 * * * *' workflow_dispatch: jobs: download_and_release: runs-on: ubuntu-latest permissions: contents: write steps: - name: โฌ‡๏ธ Checkout code uses: actions/checkout@v4 with: fetch-depth: 0 - name: ๐Ÿ Setup Python uses: actions/setup-python@v5 with: python-version: '3.x' - name: โš™๏ธ Install dependencies run: pip install requests anynet beautifulsoup4 - name: ๐Ÿ”ง Setup hactool run: | cp hactool-linux hactool chmod +x hactool - name: ๐Ÿ” Check latest Switch 1 firmware id: version_check shell: bash run: | LATEST_TITLE=$(curl -s 'https://yls8.mtheall.com/ninupdates/feed.php' | grep 'Switch ' | grep -v '<title>Switch 2 ' | head -n 1) LATEST_VERSION=$(echo "$LATEST_TITLE" | grep -oP 'Switch \K[0-9.]+') if git ls-remote --tags origin "$LATEST_VERSION" | grep -q "$LATEST_VERSION"; then echo "new_version=false" >> $GITHUB_OUTPUT exit 0 fi echo "new_version=true" >> $GITHUB_OUTPUT echo "version=$LATEST_VERSION" >> $GITHUB_OUTPUT - name: โฌ‡๏ธ Download firmware if: steps.version_check.outputs.new_version == 'true' run: | python3 firmware_downloader.py | tee firmware_output.txt - name: ๐Ÿงน Remove .nca.1 files if: steps.version_check.outputs.new_version == 'true' run: | FOLDER="Firmware ${{ steps.version_check.outputs.version }}" find "$FOLDER" -name "*.nca.1" -delete - name: ๐Ÿ“ Prepare changelog if: steps.version_check.outputs.new_version == 'true' run: | { echo "### Notes" echo "- Official Nintendo Switch firmware download" echo "" tail -n 4 firmware_output.txt } > release_body.txt - name: ๐Ÿ“ฆ Create firmware zip if: steps.version_check.outputs.new_version == 'true' run: | zip -r "Firmware ${{ steps.version_check.outputs.version }}.zip" \ "Firmware ${{ steps.version_check.outputs.version }}" - name: ๐Ÿš€ Create GitHub Release if: steps.version_check.outputs.new_version == 'true' uses: softprops/action-gh-release@v2 with: tag_name: ${{ steps.version_check.outputs.version }} name: Firmware ${{ steps.version_check.outputs.version }} body_path: release_body.txt files: Firmware ${{ steps.version_check.outputs.version }}.zip env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}