forked from ZqinKing/wrt_relese
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (130 loc) · 4.92 KB
/
relese_wrt.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
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:
- jdcloud_ipq60xx_libwrt
- jdcloud_ipq60xx_immwrt
- jdcloud_ipq60xx_lede
- cmcc_rax3000m_immwrt
- redmi_ax6000_immwrt21
- jdcloud_ax6000_immwrt
- redmi_ax5_immwrt
- zn_m2_libwrt
- x64_immwrt
- jdcloud_ipq60xx_k612
- n1_immwrt
runs-on:
required: true
description: Runs on...
type: choice
default: ubuntu-22.04
options:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-latest
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