Skip to content

Commit a005fbb

Browse files
committed
first commit
0 parents  commit a005fbb

File tree

19 files changed

+1591
-0
lines changed

19 files changed

+1591
-0
lines changed

.github/workflows/build-openwrt.yml

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#=================================================
2+
# https://github.com/P3TERX/Actions-OpenWrt
3+
# Description: Build OpenWrt using GitHub Actions
4+
# Lisence: MIT
5+
# Author: P3TERX
6+
# Blog: https://p3terx.com
7+
#=================================================
8+
9+
name: Build OpenWrt
10+
11+
on:
12+
# push:
13+
# branches:
14+
# - master
15+
schedule:
16+
- cron: 0 16 * * 6
17+
watch:
18+
types: started
19+
20+
env:
21+
REPO_URL: https://github.com/openwrt/openwrt
22+
REPO_BRANCH: master
23+
CONFIG_FILE: X86_64.config
24+
DIY_SH: diy.sh
25+
FREE_UP_DISK: true
26+
SSH_ACTIONS: false
27+
UPLOAD_BIN_DIR: false
28+
UPLOAD_FIRMWARE: true
29+
UPLOAD_COWTRANSFER: false
30+
TZ: Asia/Shanghai
31+
32+
jobs:
33+
build:
34+
if: github.event.repository.owner.id == github.event.sender.id
35+
runs-on: ubuntu-latest
36+
steps:
37+
- name: Checkout
38+
uses: actions/checkout@master
39+
40+
- name: Initialization environment
41+
env:
42+
DEBIAN_FRONTEND: noninteractive
43+
run: |
44+
sudo swapoff /swapfile
45+
sudo rm -rf /swapfile /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
46+
sudo -E apt-get -qq update
47+
sudo -E apt-get -qq install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs gcc-multilib g++-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler ccache xsltproc rename
48+
sudo -E apt-get -qq autoremove --purge
49+
sudo -E apt-get -qq clean
50+
curl -fsSL https://raw.githubusercontent.com/P3TERX/dotfiles/master/.bashrc >> ~/.bashrc
51+
52+
- name: Clone source code
53+
run: git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
54+
55+
- name: Free up disk space
56+
if: env.FREE_UP_DISK == 'true'
57+
env:
58+
DEBIAN_FRONTEND: noninteractive
59+
run: |
60+
sudo mkdir -p -m 777 /mnt/openwrt/build_dir/hostpkg /mnt/openwrt/build_dir/host openwrt/build_dir /mnt/openwrt/dl /mnt/openwrt/feeds /mnt/openwrt/staging_dir
61+
ln -s /mnt/openwrt/build_dir/hostpkg openwrt/build_dir/hostpkg
62+
ln -s /mnt/openwrt/build_dir/host openwrt/build_dir/host
63+
ln -s /mnt/openwrt/dl openwrt/dl
64+
ln -s /mnt/openwrt/staging_dir openwrt/staging_dir
65+
66+
- name: Update feeds
67+
run: cd openwrt && ./scripts/feeds update -a
68+
69+
- name: Install feeds
70+
run: cd openwrt && ./scripts/feeds install -a
71+
72+
- name: Load custom configuration
73+
run: |
74+
[ -e files ] && mv files openwrt/files
75+
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
76+
chmod +x $DIY_SH
77+
cd openwrt
78+
../$DIY_SH
79+
make defconfig
80+
81+
- name: SSH connection to Actions
82+
uses: P3TERX/debugger-action@master
83+
if: env.SSH_ACTIONS == 'true'
84+
85+
- name: Download package
86+
id: package
87+
run: |
88+
cd openwrt
89+
make download -j8
90+
find dl -size -1024c -exec ls -l {} \;
91+
find dl -size -1024c -exec rm -f {} \;
92+
93+
- name: Compile the firmware
94+
id: compile
95+
run: |
96+
cd openwrt
97+
echo -e "$(($(nproc)+1)) thread compile"
98+
make -j$(($(nproc)+1)) || make -j1 V=s
99+
echo "::set-output name=status::success"
100+
101+
- name: Upload bin directory
102+
uses: actions/upload-artifact@master
103+
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
104+
with:
105+
name: OpenWrt_bin
106+
path: openwrt/bin
107+
108+
- name: Organize files
109+
id: organize
110+
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
111+
run: |
112+
mkdir firmware && find openwrt/bin/targets/*/*/* -maxdepth 0 -name "*uefi-gpt*" -or -name "*combined*" -or -name "*.vmdk" -or -name "sha256sums" | xargs -i mv -f {} ./firmware/
113+
cp openwrt/.config ./firmware/config.txt
114+
cd firmware
115+
echo "::set-env name=FIRMWARE::$PWD"
116+
echo "::set-output name=status::success"
117+
118+
- name: Upload firmware directory
119+
uses: actions/upload-artifact@master
120+
if: steps.organize.outputs.status == 'success' && !cancelled()
121+
with:
122+
name: OpenWrt_firmware
123+
path: ${{ env.FIRMWARE }}
124+
125+
- name: Get current date
126+
id: date
127+
run: echo "::set-output name=date::$(date +'%m/%d,%Y')"
128+
129+
- name: Upload binaries to release
130+
uses: svenstaro/upload-release-action@v1-release
131+
if: steps.compile.outputs.status == 'success' && !cancelled()
132+
with:
133+
repo_token: ${{ secrets.REPO_TOKEN }}
134+
file: ${{ env.FIRMWARE }}/*
135+
tag: ${{steps.date.outputs.date}}
136+
overwrite: true
137+
file_glob: true
138+
139+
- name: Upload firmware to cowtransfer
140+
if: env.UPLOAD_COWTRANSFER == 'true' && !cancelled()
141+
run: |
142+
curl -sL https://git.io/cowtransfer | sh
143+
./cowtransfer-uploader -s -p 8 ${{ env.FIRMWARE }}/*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2019 P3TERX
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Actions OpenWrt Snapshot With Nginx
2+
3+
openwrt官方master分支版本,Kernel 5.4,包含了主流插件以及针对国内环境做了必要的优化,主要针对X86_64,其他设备请自行调整与编译,uhttpd换成了nginx,大大增加了可玩性,比如PHP,kodexplorer,webdav,反向代理等,可作为NAS使用.
4+
5+
[Releases](https://github.com/garypang13/Actions-OpenWrt-Snapshot/releases)下载已编译好的固件,周更.
6+
7+
后台入口 10.0.0.1  (若后台无法打开,请插拔交换wan,lan网线顺序,默认第一个网口eth0为wan口,第二个网eth1口为lan口.)
8+
9+
默认密码 root
10+
11+
第一次使用请采用全新安装,避免出现升级失败以及其他一些可能的Bug.
12+
13+
自己编译需要[在此](https://github.com/settings/tokens)创建个token,然后在此仓库Settings->Secrets中添加个名字为REPO_TOKEN的Secret,填入token值,否者无法release
14+
15+
diy云编译教程: [Read the details in my blog (in Chinese) | 中文教程](https://p3terx.com/archives/build-openwrt-with-github-actions.html)
16+
17+
[![LICENSE](https://img.shields.io/github/license/mashape/apistatus.svg?style=flat-square&label=LICENSE)](https://github.com/P3TERX/Actions-OpenWrt/blob/master/LICENSE)
18+
[![GitHub Stars](https://img.shields.io/github/stars/P3TERX/Actions-OpenWrt.svg?style=flat-square&label=Stars)](https://github.com/P3TERX/Actions-OpenWrt/stargazers)
19+
[![GitHub Forks](https://img.shields.io/github/forks/P3TERX/Actions-OpenWrt.svg?style=flat-square&label=Forks)](https://github.com/P3TERX/Actions-OpenWrt/fork)
20+
21+
Build OpenWrt using GitHub Actions
22+
23+
24+
25+
[GitHub Actions Group](https://t.me/GitHub_Actions) | [GitHub Actions Channel](https://t.me/GitHub_Actions_Channel)
26+
27+
## Usage
28+
29+
- Sign up for [GitHub Actions](https://github.com/features/actions/signup)
30+
- Fork [this GitHub repository](https://github.com/P3TERX/Actions-OpenWrt)
31+
- Generate `.config` files using [OpenWrt](https://github.com/openwrt/openwrt/tree/openwrt-19.07) source code.
32+
- Push `.config` file to the GitHub repository, and the build starts automatically.Progress can be viewed on the Actions page.
33+
- When the build is complete, click the `Artifacts` button in the upper right corner of the Actions page to download the binaries.
34+
35+
## Acknowledgments
36+
37+
- [Microsoft](https://www.microsoft.com)
38+
- [Microsoft Azure](https://azure.microsoft.com)
39+
- [GitHub](https://github.com)
40+
- [GitHub Actions](https://github.com/features/actions)
41+
- [tmate](https://github.com/tmate-io/tmate)
42+
- [mxschmitt/action-tmate](https://github.com/mxschmitt/action-tmate)
43+
- [csexton/debugger-action](https://github.com/csexton/debugger-action)
44+
- [Cisco](https://www.cisco.com/)
45+
- [OpenWrt](https://github.com/openwrt/openwrt)
46+
- [Lean's OpenWrt](https://github.com/coolsnowwolf/lede)
47+
48+
## License
49+
50+
[MIT](https://github.com/P3TERX/Actions-OpenWrt/blob/master/LICENSE) © P3TERX

0 commit comments

Comments
 (0)