-
Notifications
You must be signed in to change notification settings - Fork 19
169 lines (148 loc) · 5.45 KB
/
master-mtkfilogic.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
#
name: master-mtkfilogic
permissions: write-all
#开启写权限,防止无法上传到release
on:
repository_dispatch:
workflow_dispatch:
# schedule:
# - cron: 0 22 * * 3
# 分,时,日,月,星期。每周 四 22时执行一次 (UTC时间)
env:
REPO_URL: https://github.com/immortalwrt/immortalwrt
REPO_BRANCH: master
PLATFORM_FILE: configs/Platform-filogic.txt
CONFIG_FILE: configs/Packages-reduce.txt
FREE_DISK_SH: scripts/free_disk_space.sh
ENV_SH: scripts/environment.sh
SETTINGS_SH: scripts/init-settings.sh
PACKAGES_SH: scripts/packages.sh
CLASH_CORE_SH: scripts/preset-clash-core-arm64-L.sh
UPLOAD_BIN_DIR: false
UPLOAD_FIRMWARE: false
UPLOAD_RELEASE: true
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-24.04
steps:
- name: 检查
uses: actions/checkout@main
- name: 初始化环境
env:
DEBIAN_FRONTEND: noninteractive
run: |
chmod +x $FREE_DISK_SH && $FREE_DISK_SH
sudo -E apt-get -qq update -y
sudo -E apt-get -qq full-upgrade -y
chmod +x $ENV_SH && $ENV_SH
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo timedatectl set-timezone "$TZ"
docker image prune -a -f
docker container prune -f
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: 检查空间使用情况1
if: (!cancelled())
run: df -hT
- name: 克隆源码
working-directory: /workdir
run: |
git clone $REPO_URL -b $REPO_BRANCH openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
# - name: 开启缓存
# uses: klever1988/cachewrtbuild@main
# with:
# ccache: 'true'
# mixkey: 'master-filogic'
# prefix: ${{ github.workspace }}/openwrt
- name: 更新 & 安装 feeds & 执行脚本
run: |
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
chmod +x $GITHUB_WORKSPACE/$SETTINGS_SH && $GITHUB_WORKSPACE/$SETTINGS_SH
chmod +x $GITHUB_WORKSPACE/$PACKAGES_SH && $GITHUB_WORKSPACE/$PACKAGES_SH
chmod +x $GITHUB_WORKSPACE/$CLASH_CORE_SH && $GITHUB_WORKSPACE/$CLASH_CORE_SH
- name: 导入补丁和配置 & 下载文件
run: |
[ -d files ] && mv files openwrt/files || echo "files not found"
[ -f $CPLATFORM_FILE ] && cat $PLATFORM_FILE >> openwrt/.config
[ -f $CONFIG_FILE ] && cat $CONFIG_FILE >> openwrt/.config
cd openwrt
make defconfig
make download -j8 V=10
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: 编译固件
id: compile
run: |
cd openwrt
echo -e "$(($(nproc)+1)) thread compile"
make -j$(($(nproc)+1)) || make -j$(nproc) || make -j1 V=s
echo "status=success" >> $GITHUB_OUTPUT
- name: 空间使用情况2
if: (!cancelled())
run: df -hT
- name: 上传 bin 目录
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
with:
name: OpenWrt_bin${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
path: openwrt/bin
- name: 整理文件
id: organize
if: steps.compile.outputs.status == 'success'
run: |
cd openwrt/bin/targets/*/*
rm -rf *.buildinfo
rm -rf *.json
rm -rf *.manifest
rm -rf packages
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
- name: 上传固件目录
uses: actions/upload-artifact@main
if: env.UPLOAD_FIRMWARE == 'true' && steps.organize.outputs.status == 'success' && !cancelled()
with:
name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
path: ${{ env.FIRMWARE }}
- name: 生成发布标签
id: tag
if: env.UPLOAD_RELEASE == 'true' && steps.compile.outputs.status == 'success' && !cancelled()
run: |
echo -e "✅ master 源码 MTK filogic 平台 \n⁉️ 刷不进去的,可以尝试同机型ubootmod版本(应该是闪存有坏快的缘故)\nℹ 256M运存建议设置每天重启一次,不然容易出现爆运存导致卡网" >> release.txt
echo "release_tag=$(date +"%Y.%m.%d-master_filogic")" >> $GITHUB_OUTPUT
echo "status=success" >> $GITHUB_OUTPUT
- name: 上传固件到发布
uses: softprops/[email protected]
if: steps.tag.outputs.status == 'success' && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
body_path: release.txt
files: ${{ env.FIRMWARE }}/*
- name: 删除以前发布的固件
uses: dev-drprasad/[email protected]
if: steps.compile.outputs.status == 'success' && env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 15
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 删除以前的工作流程
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 5