798x-UBOOT #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 798x-UBOOT | |
on: | |
#自动编译:每周日早上4点 | |
schedule: | |
- cron: 0 20 * * 0 | |
#手动编译 | |
workflow_dispatch: | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
WRT_TARGET: MTK-798x | |
WRT_REPO: https://github.com/hanwckf/bl-mt798x.git | |
WRT_BRANCH: master | |
permissions: write-all | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete Old Releases | |
uses: dev-drprasad/delete-older-releases@master | |
with: | |
keep_latest: 0 | |
delete_tags: true | |
- name: Delete Old Workflows | |
uses: Mattraks/delete-workflow-runs@main | |
with: | |
retain_days: 0 | |
keep_minimum_runs: 1 | |
build: | |
runs-on: ubuntu-latest | |
needs: cleanup | |
strategy: | |
fail-fast: false | |
#max-parallel: 4 | |
matrix: | |
WRT_ATF: [atf-20220606-637ba581b, atf-20231013-0ea67d76a] | |
WRT_MTK: [uboot-mtk-20220606, uboot-mtk-20230718-09eda825] | |
steps: | |
- name: Checkout Projects | |
uses: actions/checkout@main | |
- name: Free Disk Space | |
uses: endersonmenezes/free-disk-space@main | |
with: | |
remove_android: true | |
remove_dotnet: true | |
remove_haskell: true | |
remove_tool_cache: true | |
remove_swap: true | |
remove_packages: "android* azure* clang* dotnet* firefox* ghc* golang* google* libclang* libgl1* lld* llvm* \ | |
microsoft* mongodb* mono* mysql* nodejs* openjdk* php* postgresql* powershell* snap* temurin* yarn* zulu*" | |
remove_packages_one_command: true | |
remove_folders: "/etc/apt/sources.list.d* /etc/mono* /etc/mysql* /usr/include/linux/android* /usr/lib/llvm* /usr/lib/mono* \ | |
/usr/local/lib/android* /usr/local/lib/node_modules* /usr/local/share/chromium* /usr/local/share/powershell* \ | |
/usr/local/share/vcpkg/ports/azure* /usr/local/share/vcpkg/ports/google* /usr/local/share/vcpkg/ports/libpq/android* \ | |
/usr/local/share/vcpkg/ports/llvm* /usr/local/share/vcpkg/ports/mysql* /usr/local/share/vcpkg/ports/snap* \ | |
/usr/share/azure* /usr/share/dotnet* /usr/share/glade* /usr/share/miniconda* /usr/share/php* /usr/share/swift \ | |
/var/lib/mysql* /var/log/azure*" | |
testing: false | |
- name: Initialization Environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
docker rmi $(docker images -q) | |
sudo -E apt -yqq update | |
sudo -E apt -yqq full-upgrade | |
sudo -E apt -yqq autoremove --purge | |
sudo -E apt -yqq autoclean | |
sudo -E apt -yqq clean | |
sudo -E apt -yqq install bison build-essential device-tree-compiler dos2unix flex gcc-aarch64-linux-gnu libssl-dev | |
sudo -E systemctl daemon-reload | |
sudo -E timedatectl set-timezone "Asia/Shanghai" | |
- name: Initialization Values | |
run: | | |
export WRT_AUTHOR=$(echo $WRT_REPO | cut -d '/' -f 4) | |
export WRT_DATE=$(TZ=UTC-8 date +"%y.%m.%d") | |
export WRT_VER=$(echo ${{matrix.WRT_ATF}} | grep -oP 'atf-\d+')_$(echo ${{matrix.WRT_MTK}} | grep -oP 'mtk-\d+') | |
export WRT_MULTI_TYPE=$(sed -n "2{s/^#//;s/\r$//;p;q}" $GITHUB_WORKSPACE/Uboots.sh) | |
export WRT_SINGLE_TYPE=$(sed -n "1{s/^#//;s/\r$//;p;q}" $GITHUB_WORKSPACE/Uboots.sh) | |
echo "WRT_AUTHOR=$WRT_AUTHOR" >> $GITHUB_ENV | |
echo "WRT_DATE=$WRT_DATE" >> $GITHUB_ENV | |
echo "WRT_VER=$WRT_VER" >> $GITHUB_ENV | |
echo "WRT_MULTI_TYPE=$WRT_MULTI_TYPE" >> $GITHUB_ENV | |
echo "WRT_SINGLE_TYPE=$WRT_SINGLE_TYPE" >> $GITHUB_ENV | |
- name: Clone Code | |
run: | | |
git clone --depth=1 --single-branch --branch $WRT_BRANCH $WRT_REPO ./wrt/ | |
- name: Check Scripts | |
run: | | |
find ./ -maxdepth 3 -type f -iregex ".*\(txt\|sh\)$" -exec dos2unix {} \; -exec chmod +x {} \; | |
- name: Modified Version | |
run: | | |
cd ./wrt/ | |
sed -i "5s/UBOOT_DIR=.*/UBOOT_DIR=${{matrix.WRT_MTK}}/" ./build.sh | |
sed -i "7s/ATF_DIR=.*/ATF_DIR=${{matrix.WRT_ATF}}/" ./build.sh | |
- name: Compile Firmware | |
run: | | |
cd ./wrt/ | |
$GITHUB_WORKSPACE/Uboots.sh | |
- name: Machine Information | |
run: | | |
cd ./wrt/ | |
echo "=======================" | |
lscpu | grep -E "name|Core|Thread" | |
echo "=======================" | |
df -h | |
echo "=======================" | |
du -h --max-depth=1 | |
echo "=======================" | |
- name: Package Firmware | |
run: | | |
cd ./wrt/ && mkdir ./upload/ | |
for FILE in $(find ./output/ -type f -iname "*.*") ; do | |
EXT=$(basename $FILE | cut -d '.' -f 2-) | |
NAME=$(basename $FILE | cut -d '.' -f 1) | |
NEW_FILE="$NAME"_"$WRT_VER"_"$WRT_DATE"."$EXT" | |
mv -f $FILE ./upload/$NEW_FILE | |
done | |
zip -r ./upload/"$WRT_AUTHOR"_"$WRT_VER"_"$WRT_DATE".zip ./upload/*.* | |
- name: Release Firmware | |
uses: softprops/action-gh-release@master | |
with: | |
tag_name: ${{env.WRT_AUTHOR}}_${{env.WRT_VER}}_${{env.WRT_DATE}} | |
files: ./wrt/upload/*.* | |
body: | | |
这是个平台固件包,内含多个设备! | |
请注意选择你需要的设备固件! | |
不要问,刷就完事了! | |
平台:${{env.WRT_TARGET}} | |
源码:${{env.WRT_REPO}} | |
ATF版本:${{matrix.WRT_ATF}} | |
MTK版本:${{matrix.WRT_MTK}} | |
单分区设备:${{env.WRT_SINGLE_TYPE}} | |
多分区设备:${{env.WRT_MULTI_TYPE}} |