generated from P3TERX/Actions-OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (127 loc) · 4.75 KB
/
openwrtN1.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
name: openwrtN1
on:
repository_dispatch:
workflow_dispatch:
inputs:
ssh:
description: 'SSH connection to Actions'
required: false
default: 'false'
schedule:
- cron: 0 0 * * 5
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
FEEDS_CONF: feeds.conf.default
CONFIG_FILE: .config
SCRIPT_SH: script.sh
CONFIG_SH: config.sh
UPLOAD_FIRMWARE: true
TZ: Asia/Shanghai
jobs:
build_openwrt:
name: Build OpenWrt and release
runs-on: ubuntu-20.04
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: main
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/apt/sources.list.d
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php*
sudo -E apt update -y
sudo -E apt full-upgrade -y
sudo -E apt install -y 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 libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip 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
sudo timedatectl set-timezone "$TZ"
df -h
- 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: Load custom feeds
run: |
[ -e files ] && mv files openwrt/files
- name: Update feeds
run: cd openwrt && ./scripts/feeds update -a
- name: Install feeds
run: |
chmod +x $SCRIPT_SH
./$SCRIPT_SH
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
echo "::set-output name=status::success"
- 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: 5.15.121_6.1.40
KERNEL_AUTO_LATEST: true
WHOAMI: CHH
GH_TOKEN: ${{ secrets.RELEASES_TOKEN }}
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: OpenWrt_s905d_${{ env.PACKAGED_OUTPUTDATE }}
name: N1-OpenWrt | ${{ env.DATE }}
allowUpdates: true
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/*
token: ${{ secrets.RELEASES_TOKEN }}
body: |
N1 OpenWrt Argon
* IP:10.0.0.1
默认用户名:root
默认密码:password
安装到EMMC及在线更新:系统-->晶晨宝盒
- name: Remove old Releases
uses: dev-drprasad/delete-older-releases@v0.2.1
with:
keep_latest: 10
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.RELEASES_TOKEN }}
- name: Delete older workflow runs and artifacts
uses: Mattraks/delete-workflow-runs@v2
if: env.DELETE_ARTIFACTS == 'true'
with:
token: ${{ secrets.RELEASES_TOKEN }}
repository: ${{ github.repository }}
retain_days: 30
keep_minimum_runs: 6