forked from esirplayground/AutoBuild-OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (124 loc) · 5.23 KB
/
Build_LEDE_OP_x86_Releases.yml
File metadata and controls
138 lines (124 loc) · 5.23 KB
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
#=================================================
# Description: Build OpenWrt using GitHub Actions
# Lisence: MIT
# Author: eSirPlayground
# Youtube Channel: https://goo.gl/fvkdwm
#=================================================
name: Build_x86_Releases
# Add a button to trigger the workflow
on:
repository_dispatch:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
set +e
# 1. 删除所有docker镜像(占大量空间)
docker rmi -f $(docker images -aq) || true
# 2. 深度清理系统无用文件
sudo rm -rf \
/usr/share/dotnet \
/etc/mysql \
/usr/local/lib/android \
/opt/ghc \
/etc/php \
/usr/share/gradle \
/usr/share/maven \
/usr/local/share/powershell \
/usr/lib/jvm \
/var/lib/docker \
/tmp/* \
/var/tmp/*
# 3. 卸载更多无用软件包
sudo -E apt-get -y purge \
azure-cli* docker* ghc* zulu* hhvm* llvm* firefox* google* dotnet* \
aspnetcore* powershell* openjdk* adoptopenjdk* mysql* php* mongodb* \
moby* snap* nodejs* npm* yarn* || true
# 4. 清理apt缓存
sudo -E apt-get update
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
sudo rm -rf /var/lib/apt/lists/*
# 5. 查看磁盘空间(可选,调试用)
df -h
#安装依赖
sudo -E apt-get update
sudo -E apt-get -y install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev libreadline-dev libssl-dev libtool llvm lrzsz libnsl-dev ninja-build p7zip p7zip-full patch pkgconf python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
- name: Clone source code
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
run: |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
cd openwrt
echo -e "src-git passwall_packages https://github.com/Openwrt-Passwall/openwrt-passwall-packages.git;main\nsrc-git passwall_luci https://github.com/Openwrt-Passwall/openwrt-passwall.git;main" >> ./feeds.conf.default
- name: Update & Install feeds
working-directory: ./openwrt
run: |
./scripts/feeds update -a
./scripts/feeds install -a
./scripts/feeds install -a
#- name: Import external feeds - passwall
# working-directory: ./openwrt
# run: |
# git clone https://github.com/xiaorouji/openwrt-passwall.git package/lienol
# git clone "your_github_link" package/"your_folder_name"
#- name: Import external feeds - JerryKuKu Argon
# working-directory: ./openwrt
# run: |
# git clone -b 18.06 https://github.com/jerrykuku/luci-theme-argon.git package/luci-theme-argon-jerrykuku
- name: Configuration Customization - Build_x86
env:
CONFIG_FILE: 'x86.config'
run: |
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
chmod +x ./customize.sh && ./customize.sh
cd openwrt && make defconfig
- name: Download package
working-directory: ./openwrt
run: |
make download -j$(nproc)
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Build firmware
working-directory: ./openwrt
run: |
echo -e "1 thread build."
make -j1 V=s
# make -j$(nproc) V=s
# 步骤1:生成唯一的Tag(仅用GITHUB_ENV注入,移除过时的set-output)
- name: Generate release tag
run: |
# 生成时间戳格式的Tag,避免重复
TAG="OpenWrt-x86-$(date +%Y%m%d-%H%M%S)"
# 仅用这一行注入环境变量(新版推荐写法)
echo "TAG_NAME=$TAG" >> $GITHUB_ENV
# 可选:打印变量验证是否生成成功(方便调试)
echo "Generated tag: $TAG"
# 步骤2:创建Release并上传文件(确保正确引用env.TAG_NAME)
- name: Upload to GitHub Releases
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# 正确引用环境变量(核心修复点)
tag_name: ${{ env.TAG_NAME }}
name: ${{ env.TAG_NAME }}
body: "OpenWRT x86 固件编译于 $(date +%Y-%m-%d %H:%M:%S)"
# 分开上传的固件文件路径(根据实际情况调整后缀)
files: |
openwrt/bin/targets/*/*/*.img.gz
openwrt/bin/targets/*/*/*.iso
openwrt/bin/targets/*/*/*.vmdk
openwrt/bin/targets/*/*/*.qcow2
draft: false
prerelease: false