Relese - jdcloud_ipq60xx_libwrt #10
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: Relese WRT | |
run-name: Relese - ${{ inputs.model }} | |
on: | |
workflow_dispatch: | |
inputs: | |
model: | |
required: true | |
description: Device Model | |
type: choice | |
default: jdcloud_ipq60xx_immwrt | |
options: | |
- aliyun_ap8220_immwrt | |
- cmcc_rax3000m_immwrt | |
- jdcloud_ax6000_immwrt | |
- jdcloud_ipq60xx_immwrt | |
- jdcloud_ipq60xx_libwrt | |
- n1_immwrt | |
- redmi_ax5_immwrt | |
- redmi_ax6000_immwrt21 | |
- zn_m2_libwrt | |
- x64_immwrt | |
runs-on: | |
required: true | |
description: Runs on... | |
type: choice | |
default: ubuntu-22.04 | |
options: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
build: | |
runs-on: ${{ inputs.runs-on }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Free Disk Space | |
uses: FirelightFlagboy/gh-runner-free-disk-space@main | |
with: | |
tool-cache: true | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
docker-images: true | |
swap-storage: true | |
- name: Initialization Environment | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
run: | | |
sudo bash -c 'bash <(curl -sL https://build-scripts.immortalwrt.org/init_build_environment.sh)' | |
sudo -E apt -yqq install dos2unix | |
sudo -E apt -yqq install libfuse-dev | |
sudo -E apt -yqq autoremove --purge | |
sudo -E apt -yqq autoclean | |
sudo -E apt -yqq clean | |
sudo -E systemctl daemon-reload | |
sudo -E timedatectl set-timezone "Asia/Shanghai" | |
- name: Initialization Values | |
run: | | |
export BUILD_DATE=$(TZ=UTC-8 date +"%y.%m.%d_%H.%M.%S") | |
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV | |
export BUILD_SRC=$(awk -F"=" '/REPO_URL/ {print $NF}' "./compilecfg/${{ inputs.model }}.ini") | |
echo "BUILD_SRC=$BUILD_SRC" >> $GITHUB_ENV | |
- name: Pre Clone | |
run: ./pre_clone_action.sh ${{ inputs.model }} | |
- name: Cache Dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
./action_build/.ccache | |
./action_build/staging_dir | |
key: ${{ inputs.runs-on }}-${{ hashFiles('**/repo_flag') }}-${{ env.BUILD_DATE }} | |
restore-keys: | | |
${{ inputs.runs-on }}-${{ hashFiles('**/repo_flag') }}- | |
- name: Refresh the cache | |
run: | | |
if [ -d "./action_build/staging_dir" ]; then | |
find "./action_build/staging_dir" -type d -name "stamp" -not -path "*target*" | while read -r dir; do | |
find "$dir" -type f -exec touch {} + | |
done | |
fi | |
- name: Build Firmware | |
run: ./build.sh ${{ inputs.model }} | |
- name: Get Kernel Verion | |
run: | | |
# 获取内核版本 | |
echo "KVER=$(find ./action_build/dl -maxdepth 1 -name "linux-[4-6]\.*" | sort -r | head -n 1 | grep -oE "[4-6]\.[0-9]{1,3}\.[0-9]{1,3}")" >> $GITHUB_ENV | |
- name: Delete Old Cache | |
run: | | |
# 获取缓存列表并删除 | |
gh cache list --key ${{ inputs.runs-on }}-${{ hashFiles('**/repo_flag') }}- --json key --jq '.[] | .key' | while read -r key; do | |
gh cache delete "$key" | |
done | |
# 输出缓存状态 | |
echo "========cache status========" | |
echo "ccache: $(du -sh ./action_build/.ccache | cut -f 1)" | |
echo "staging: $(du -sh ./action_build/staging_dir | cut -f 1)" | |
- name: Machine Information | |
run: | | |
echo "==============================================" | |
lscpu | grep -E "name|Core|Thread" | |
echo "==============================================" | |
df -h | |
echo "==============================================" | |
- name: Package OpenWrt Firmware | |
if: ${{ inputs.model == 'n1_immwrt' }} | |
uses: unifreq/openwrt_packit@master | |
env: | |
OPENWRT_ARMVIRT: firmware/*.tar.gz | |
PACKAGE_SOC: s905d | |
KERNEL_VERSION_NAME: 6.6.y | |
WHOAMI: ZqinKing | |
- name: Prepare Release Body | |
run: | | |
echo "云编译发布" > release_body.txt | |
echo "源码:${{ env.BUILD_SRC }}" >> release_body.txt | |
echo "Kernel: ${{ env.KVER }}" >> release_body.txt | |
echo "WIFI密码: 12345678" >> release_body.txt | |
echo "LAN地址: 192.168.1.1" >> release_body.txt | |
echo "插件:" >> release_body.txt | |
echo "$(grep -oP "luci-app-[a-zA-Z0-9]{1,30}" ./firmware/*.manifest | awk -F":" '{print $NF}')" >> release_body.txt | |
- name: Release Firmware | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: ${{ env.BUILD_DATE }}_${{ inputs.model }} | |
files: ${{ inputs.model == 'n1_immwrt' && env.PACKAGED_OUTPUTPATH || './firmware' }}/*.* | |
body_path: ./release_body.txt |