From cdca1ee5efa87733072a07b9355a0e5b20d30380 Mon Sep 17 00:00:00 2001 From: zyb Date: Mon, 24 Jun 2024 15:30:39 +0800 Subject: [PATCH] modified: .github/workflows/mikrotik_patch.yml --- .github/workflows/mikrotik_patch.yml | 50 +++++++++------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/.github/workflows/mikrotik_patch.yml b/.github/workflows/mikrotik_patch.yml index 1981fb6..c6f7476 100644 --- a/.github/workflows/mikrotik_patch.yml +++ b/.github/workflows/mikrotik_patch.yml @@ -14,6 +14,7 @@ jobs: env: TZ: 'Asia/Shanghai' steps: + - name: Create squashfs for option npk run: | cd $GITHUB_WORKSPACE @@ -87,24 +88,30 @@ jobs: echo Latest Version:$LATEST_VERSION echo "LATEST_VERSION=${LATEST_VERSION}" >> $GITHUB_ENV - - name: Get netinstall-${{ env.LATEST_VERSION }}.zip + - name: Cache + id: cache + uses: actions/cache@v4 + with: + path: | + netinstall-${{ env.LATEST_VERSION }}.zip + mikrotik-${{ env.LATEST_VERSION }}.iso + key: ${{ runner.os }}-${{ env.LATEST_VERSION }} + + - name: Get netinstall-${{ env.LATEST_VERSION }}.zip and mikrotik-${{ env.LATEST_VERSION }}.iso + if: steps.cache.outputs.cache-hit != 'true' run: | sudo wget -nv -O netinstall-$LATEST_VERSION.zip https://download.mikrotik.com/routeros/$LATEST_VERSION/netinstall-$LATEST_VERSION.zip - sudo unzip netinstall-$LATEST_VERSION.zip - sudo rm netinstall-$LATEST_VERSION.zip + sudo wget -nv -O mikrotik-$LATEST_VERSION.iso https://download.mikrotik.com/routeros/$LATEST_VERSION/mikrotik-$LATEST_VERSION.iso - name: Patch netinstall.exe run: | sudo -E python3 patch.py netinstall netinstall.exe sudo zip netinstall-$LATEST_VERSION.zip ./netinstall.exe - - name: Get mikrotik-${{ env.LATEST_VERSION }}.iso - run: | - sudo wget -nv -O mikrotik-$LATEST_VERSION.iso https://download.mikrotik.com/routeros/$LATEST_VERSION/mikrotik-$LATEST_VERSION.iso - - name: Patch mikrotik-${{ env.LATEST_VERSION }}.iso run: | sudo apt-get install -y mkisofs > /dev/null + sudo unzip netinstall-$LATEST_VERSION.zip sudo mkdir ./iso sudo mount -o loop,ro mikrotik-$LATEST_VERSION.iso ./iso sudo mkdir ./new_iso @@ -112,7 +119,6 @@ jobs: sudo rsync -a ./iso/ ./new_iso/ sudo umount ./iso sudo rm -rf ./iso - sudo rm -f mikrotik-$LATEST_VERSION.iso sudo mv ./new_iso/routeros-$LATEST_VERSION.npk ./ sudo -E python3 patch.py npk routeros-$LATEST_VERSION.npk sudo cp keygen.zip ./new_iso/ @@ -227,9 +233,10 @@ jobs: sudo mount /dev/nbd0 ./install sudo mkdir -p ./install/EFI/BOOT sudo wget -nv -O refind-bin-0.14.2.zip https://nchc.dl.sourceforge.net/project/refind/0.14.2/refind-bin-0.14.2.zip - sudo unzip -q refind-bin-0.14.2.zip + sudo unzip refind-bin-0.14.2.zip refind-bin-0.14.2/refind/refind_x64.efi sudo rm refind-bin-0.14.2.zip sudo cp refind-bin-0.14.2/refind/refind_x64.efi ./install/EFI/BOOT/BOOTX64.EFI + sudo rm -rf refind-bin-0.14.2 echo -e 'timeout 0\ntextonly\ntextmode 0\nshowtools shutdown, reboot, exit\nmenuentry "Install RouterOS" {\n\tloader /linux\n\toptions "load_ramdisk=1 root=/dev/ram0 -install -hdd"\n}\ndefault_selection /EFI/BOOT/BOOTX64.EFI' \ > refind.conf sudo cp refind.conf ./install/EFI/BOOT/ @@ -254,31 +261,6 @@ jobs: sudo zip install-image-$LATEST_VERSION.zip ./install-image-$LATEST_VERSION.img sudo rm ./install-image-$LATEST_VERSION.img - # - name: Get install-image-${{ env.LATEST_VERSION }}.img - # run: | - # sudo wget -nv -O install-image-$LATEST_VERSION.zip https://download.mikrotik.com/routeros/$LATEST_VERSION/install-image-$LATEST_VERSION.zip - # sudo unzip install-image-$LATEST_VERSION.zip - # sudo rm install-image-$LATEST_VERSION.zip - - # - name: Patch install-image-${{ env.LATEST_VERSION }}.img - # run: | - # sudo mkdir ./install - # sudo mount -o loop install-image-$LATEST_VERSION.img ./install - # sudo rm ./install/1.npk - # NPK_FILES=$(find ./install/*.npk) - # for file in $NPK_FILES; do - # sudo -E python3 npk.py sign $file $file - # done - # sudo cp routeros-$LATEST_VERSION.npk ./install/1.npk - # sudo cp keygen.zip ./install/ - # sudo cp option-$LATEST_VERSION.npk ./install/100.npk - # sudo cp python3-$LATEST_VERSION.npk ./install/101.npk - # sudo cp linux ./install/ - # sudo umount ./install - # sudo rm -rf ./install - # sudo zip install-image-$LATEST_VERSION.zip ./install-image-$LATEST_VERSION.img - # sudo rm ./install-image-$LATEST_VERSION.img - - name: Delete Release tag ${{ env.LATEST_VERSION }} run: | HEADER="Authorization: token ${{ secrets.GITHUB_TOKEN }}"