-
Notifications
You must be signed in to change notification settings - Fork 170
169 lines (148 loc) · 5.58 KB
/
cloud-n1-openwrt.yaml
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
name: Cloud N1 OpenWrt
on:
push:
branches:
- main
paths:
- 'README.md'
- 'script.sh'
- 'config.sh'
schedule:
- cron: 0 8 * * 0
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
SCRIPT_SH: script.sh
CONFIG_SH: config.sh
UPLOAD_FIRMWARE: true
TZ: Asia/Shanghai
KERNEL_VERSION: 6.1.79
jobs:
build_openwrt:
name: Build OpenWrt and release
runs-on: ubuntu-20.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Checkout
uses: actions/[email protected]
with:
ref: main
- name: Disk space
run: |
echo "Free space:"
df -h
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-mark hold grub-efi-amd64-signed
sudo -E apt-get -qq update --fix-missing
sudo -E apt-get -qq full-upgrade
sudo -E apt-get -qq install ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib 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 lrzsz mkisofs msmtp ninja-build p7zip p7zip-full patch pkgconf python2.7 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 timedatectl set-timezone "$TZ"
- name: Clone source code
run: |
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
cd openwrt
useVersionInfo=$(git show -s --date=short --format="date: %cd<br/>commit: %s<br/>commit hash: %H")
echo "useVersionInfo=$useVersionInfo" >> $GITHUB_ENV
echo "DATE=$(date "+%Y-%m-%d %H:%M:%S")" >> $GITHUB_ENV
echo "tag_name=$(date +%Y%m%d)" >> $GITHUB_ENV
- name: Update feeds
run: |
[ -e files ] && mv files openwrt/files
chmod +x $SCRIPT_SH
./$SCRIPT_SH
cd openwrt
echo "src-git helloworld https://github.com/fw876/helloworld.git" >> "feeds.conf.default"
./scripts/feeds update -a
cat feeds/packages/utils/xfsprogs/Makefile
sed -i 's/TARGET_CFLAGS += -DHAVE_MAP_SYNC/TARGET_CFLAGS += -DHAVE_MAP_SYNC -D_LARGEFILE64_SOURCE/' feeds/packages/utils/xfsprogs/Makefile
./scripts/feeds update -a
- name: Install feeds
run: |
cd openwrt
./scripts/feeds install -a
- name: Load custom configuration
run: |
chmod +x $CONFIG_SH
./$CONFIG_SH
- name: Download package
run: |
cd openwrt
make defconfig
make download -j8
find dl -size -1024c -exec rm -f {} \;
- name: Compile the firmware
run: |
cd openwrt
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 V=s
echo "======================="
echo "Space usage:"
echo "======================="
df -h
echo "======================="
du -h --max-depth=1 ./ --exclude=build_dir --exclude=bin
du -h --max-depth=1 ./build_dir
du -h --max-depth=1 ./bin
rm -rf ./build_dir
echo "status=success" >> $GITHUB_OUTPUT
- name: Package Armvirt as OpenWrt
uses: ophub/flippy-openwrt-actions@main
env:
OPENWRT_ARMVIRT: openwrt/bin/targets/*/*/*.tar.gz
PACKAGE_SOC: s905d
KERNEL_VERSION_NAME: ${{ env.KERNEL_VERSION }}
WHOAMI: huangqian8
- name: Organize files
id: organize
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
run: |
cd openwrt/bin/targets/*/*
rm -rf packages openwrt-armvirt-64-default.manifest openwrt-armvirt-64-Image sha256sums version.buildinfo feeds.buildinfo openwrt-armvirt-64-generic-kernel.bin openwrt-armvirt-64-generic.manifest
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload firmware directory
uses: actions/upload-artifact@v3
if: steps.organize.outputs.status == 'success' && !cancelled()
with:
name: OpenWrt_firmware
path: |
${{ env.FIRMWARE }}
${{ env.PACKAGED_OUTPUTPATH }}
- name: Create release
uses: ncipollo/release-action@v1
with:
name: ${{ env.DATE }} ❤️ | N1-OpenWrt 自动编译打包
allowUpdates: true
tag: ${{ env.tag_name }}
commit: main
token: ${{ secrets.actions_release }}
body: |
编译使用版本:
${{ env.useVersionInfo }}
刷机固件简介:
打包日期:${{ env.PACKAGED_OUTPUTDATE }}
内核版本:${{ env.KERNEL_VERSION }}
默认IP:192.168.1.1 默认用户名密码: root/password
artifacts: "${{ env.FIRMWARE }}/*.*,${{ env.PACKAGED_OUTPUTPATH }}/*.*"
- name: Remove old Releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 3
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.actions_release }}