packaging armv8 openwrt #61
This file contains hidden or 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: packaging armv8 openwrt | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| source_repo: | |
| description: '选择要打包的源码固件' | |
| required: true | |
| default: 'immwrt' | |
| type: choice | |
| options: ['immwrt', 'lean'] | |
| ip_address: | |
| description: '设置默认IP地址' | |
| required: false | |
| default: '10.0.0.2' | |
| openwrt_board: | |
| description: '选择设备(CPU)型号' | |
| required: true | |
| default: 's905d_s905x3' | |
| openwrt_kernel: | |
| description: '设置内核版本' | |
| required: true | |
| default: '6.12.y_6.18.y' | |
| script_repo: | |
| description: '选择打包脚本储存库' | |
| required: false | |
| default: 'flippy' | |
| type: choice | |
| options: [flippy, ophub] | |
| kernel_repo: | |
| description: '选择内核存储库' | |
| required: false | |
| default: 'ophub/kernel' | |
| type: choice | |
| options: [ophub/kernel, breakingbadboy/OpenWrt] | |
| customize_rk3399: | |
| description: '设置rk3399设备(设备型号:dtb名称)' | |
| required: false | |
| default: '' | |
| auto_kernel: | |
| description: '自动使用最新内核' | |
| required: false | |
| default: true | |
| type: boolean | |
| upload_artifact: | |
| description: '上传固件到Artifact' | |
| required: false | |
| default: false | |
| type: boolean | |
| upload_release: | |
| description: '上传固件到Releases' | |
| required: false | |
| default: true | |
| type: boolean | |
| jobs: | |
| packaging: | |
| name: packaging armv8 ${{inputs.source_repo}} | |
| runs-on: ubuntu-24.04 | |
| env: | |
| IP_ADDRESS: ${{inputs.ip_address}} | |
| CONFIG_FILE: configs/armv8-${{inputs.source_repo}}.config | |
| DIY_SCRIPT: ${{inputs.source_repo}}.sh | |
| RELEASE_TAG: armv8-${{inputs.source_repo}} | |
| TZ: Asia/Shanghai | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Initialization Environment | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| run: | | |
| sudo rm -rf /usr/share/dotnet /usr/local/lib/android $AGENT_TOOLSDIRECTORY | |
| sudo -E apt -yqq update | |
| sudo -E apt -yqq install rename $(curl -fsSL is.gd/depends_ubuntu_2404) | |
| sudo -E apt -yqq autoremove --purge | |
| sudo -E apt -yqq autoclean | |
| sudo -E apt -yqq clean | |
| sudo timedatectl set-timezone "$TZ" | |
| - name: Generate Variables | |
| run: | | |
| REPO_URL=$(grep -oP 'REPO_URL="\K[^"]+' $DIY_SCRIPT) | |
| echo "REPO_URL=$REPO_URL" >> $GITHUB_ENV | |
| echo "SOURCE_REPO=$(basename $REPO_URL)" >> $GITHUB_ENV | |
| REPO_BRANCH=$(grep -oP 'REPO_BRANCH="\K[^"]+' $DIY_SCRIPT) | |
| echo "REPO_BRANCH=$REPO_BRANCH" >> $GITHUB_ENV | |
| echo "LITE_BRANCH=${REPO_BRANCH#*-}" >> $GITHUB_ENV | |
| TARGET_NAME=$(grep -oP "^CONFIG_TARGET_\K[a-z0-9]+(?==y)" $CONFIG_FILE) | |
| SUBTARGET_NAME=$(grep -oP "^CONFIG_TARGET_${TARGET_NAME}_\K[a-z0-9]+(?==y)" $CONFIG_FILE) | |
| echo "DEVICE_TARGET=$TARGET_NAME-$SUBTARGET_NAME" >> $GITHUB_ENV | |
| - name: Download OpenWrt Firmware | |
| id: download | |
| run: | | |
| FIRMWARE_PATH=openwrt/bin/targets/armvirt/64 | |
| [ -d "$FIRMWARE_PATH" ] || mkdir -p "$FIRMWARE_PATH" | |
| echo -e $(curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | grep "$DEVICE_TARGET.*$REPO_URL.*$REPO_BRANCH" | cut -d '"' -f4) > release.txt | |
| [ -n "$IP_ADDRESS" ] && sed -Ei "s/\b([0-9]{1,3}\.){3}[0-9]{1,3}\b/${IP_ADDRESS}/g" release.txt | |
| cd $FIRMWARE_PATH | |
| wget -q $(curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | grep "$RELEASE_TAG/" | grep -v img.gz | cut -d '"' -f4) | |
| echo "FIRMWARE_PATH=$PWD" >> $GITHUB_ENV | |
| echo "FILE_DATE=$(date +"%Y.%m.%d")" >> $GITHUB_ENV | |
| echo "DATE=$(date +"%Y.%m.%d-%H:%M:%S")" >> $GITHUB_ENV | |
| - name: Use Flippy Script Packaging | |
| if: steps.download.conclusion == 'success' && github.event.inputs.script_repo == 'flippy' | |
| uses: haiibo/flippy-openwrt-actions@main | |
| env: | |
| OPENWRT_ARMSR: openwrt/bin/targets/*/*/*rootfs.tar.gz | |
| PACKAGE_SOC: ${{inputs.openwrt_board}} | |
| KERNEL_REPO_URL: ${{inputs.kernel_repo}} | |
| KERNEL_VERSION_NAME: ${{inputs.openwrt_kernel}} | |
| KERNEL_AUTO_LATEST: ${{inputs.auto_kernel}} | |
| OPENWRT_IP: ${{inputs.ip_address}} | |
| CUSTOMIZE_RK3399: ${{inputs.customize_rk3399}} | |
| WHOAMI: flippy | |
| - name: Use Ophub Script Packaging | |
| if: steps.download.conclusion == 'success' && github.event.inputs.script_repo == 'ophub' | |
| uses: ophub/amlogic-s9xxx-openwrt@main | |
| with: | |
| openwrt_path: openwrt/bin/targets/*/*/*rootfs.tar.gz | |
| openwrt_ip: ${{inputs.ip_address}} | |
| openwrt_board: ${{inputs.openwrt_board}} | |
| openwrt_kernel: ${{inputs.openwrt_kernel}} | |
| auto_kernel: ${{inputs.auto_kernel}} | |
| kernel_repo: ${{inputs.kernel_repo}} | |
| builder_name: flippy | |
| - name: Organize Files | |
| if: env.PACKAGED_STATUS == 'success' | |
| run: | | |
| cd $PACKAGED_OUTPUTPATH | |
| rm -f *rootfs.tar.gz *.sha | |
| if [[ $SOURCE_REPO == 'immortalwrt' ]]; then | |
| rename 's/openwrt/${{env.SOURCE_REPO}}/' * | |
| fi | |
| - name: Upload Firmware To Artifact | |
| if: env.PACKAGED_STATUS == 'success' && github.event.inputs.upload_artifact == 'true' | |
| uses: actions/upload-artifact@main | |
| with: | |
| name: ${{env.SOURCE_REPO}}-${{env.LITE_BRANCH}}-${{env.DEVICE_TARGET}}-firmware-${{env.FILE_DATE}} | |
| path: ${{env.PACKAGED_OUTPUTPATH}} | |
| - name: Upload Firmware To Release | |
| if: env.PACKAGED_STATUS == 'success' && github.event.inputs.upload_release == 'true' | |
| uses: ncipollo/release-action@main | |
| with: | |
| name: ${{env.RELEASE_TAG}}-${{env.DATE}} | |
| allowUpdates: true | |
| removeArtifacts: true | |
| tag: ${{env.RELEASE_TAG}} | |
| token: ${{secrets.GITHUB_TOKEN}} | |
| artifacts: ${{env.FIRMWARE_PATH}}/*,${{env.PACKAGED_OUTPUTPATH}}/* | |
| bodyFile: release.txt |