forked from ZqinKing/wrt_relese
-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (104 loc) · 3.58 KB
/
build_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
name: Build WRT
run-name: Build - ${{ 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
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
- 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: 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: Upload Firmware
uses: actions/upload-artifact@v4
with:
name: ${{ env.BUILD_DATE }}_${{ inputs.model }}
path: ./firmware/*.*