Skip to content

Commit 51157e3

Browse files
committed
simple-full
1 parent c487410 commit 51157e3

3 files changed

Lines changed: 8978 additions & 3 deletions

File tree

.github/workflows/J1900_full.yml

Lines changed: 214 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,214 @@
1+
#
2+
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
3+
#
4+
# This is free software, licensed under the MIT License.
5+
# See /LICENSE for more information.
6+
#
7+
# https://github.com/P3TERX/Actions-OpenWrt
8+
# Description: Build OpenWrt using GitHub Actions
9+
#
10+
11+
name: j1900_x86 OpenWrt
12+
13+
on:
14+
push:
15+
branches:
16+
- main
17+
repository_dispatch:
18+
workflow_dispatch:
19+
inputs:
20+
ssh:
21+
description: 'SSH connection to Actions'
22+
required: true
23+
default: 'false'
24+
schedule:
25+
- cron: 0 19 * * *
26+
# watch:
27+
# types: started
28+
29+
env:
30+
REPO_URL: https://www.github.com/openwrt/openwrt
31+
REPO_BRANCH: master
32+
FEEDS_CONF: feeds.conf.default
33+
CONFIG_FILE: config/j1900.config
34+
DIY_P1_SH: diyJ1900-part1.sh
35+
DIY_P2_SH: diyJ1900-part2.sh
36+
UPLOAD_BIN_DIR: true
37+
UPLOAD_FIRMWARE: true
38+
UPLOAD_COWTRANSFER: true
39+
UPLOAD_WETRANSFER: true
40+
UPLOAD_RELEASE: false
41+
TZ: Asia/Shanghai
42+
43+
jobs:
44+
build:
45+
runs-on: ubuntu-18.04
46+
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@main
50+
51+
- name: Initialization environment
52+
env:
53+
DEBIAN_FRONTEND: noninteractive
54+
run: |
55+
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
56+
sudo -E apt-get -qq update
57+
sudo -E apt-get -qq install $(curl -fsSL git.io/depends-ubuntu-1804)
58+
sudo -E apt-get -qq autoremove --purge
59+
sudo -E apt-get -qq clean
60+
sudo timedatectl set-timezone "$TZ"
61+
sudo mkdir -p /workdir
62+
sudo chown $USER:$GROUPS /workdir
63+
- name: Clone source code
64+
working-directory: /workdir
65+
run: |
66+
df -hT $PWD
67+
git clone $REPO_URL -b $REPO_BRANCH openwrt
68+
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
69+
- name: Load custom feeds
70+
run: |
71+
[ -e $FEEDS_CONF ] && mv $FEEDS_CONF openwrt/feeds.conf.default
72+
chmod +x $DIY_P1_SH
73+
cd openwrt
74+
$GITHUB_WORKSPACE/$DIY_P1_SH
75+
git clone https://github.com/BROBIRD/openwrt-r8168 ./package/r8168
76+
77+
- name: Update feeds
78+
run: cd openwrt && ./scripts/feeds update -a
79+
80+
- name: Install feeds
81+
run: cd openwrt && ./scripts/feeds install -a
82+
83+
84+
85+
- name: SSH connection to Actions
86+
uses: P3TERX/ssh2actions@v1.0.0
87+
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')
88+
env:
89+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
90+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
91+
92+
- name: Load custom configuration
93+
run: |
94+
[ -e files ] && mv files openwrt/files
95+
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
96+
chmod +x $DIY_P2_SH
97+
cd openwrt
98+
$GITHUB_WORKSPACE/$DIY_P2_SH
99+
100+
- name: SSH connection to Actions
101+
uses: P3TERX/ssh2actions@v1.0.0
102+
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')
103+
env:
104+
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
105+
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
106+
107+
- name: Download package
108+
id: package
109+
run: |
110+
cd openwrt
111+
make defconfig
112+
make download -j8 V=99 2>&1 | tee download.log
113+
make check | tee check.log
114+
find dl -size -1024c -exec ls -l {} \;
115+
find dl -size -1024c -exec rm -f {} \;
116+
- name: Compile the firmware
117+
id: compile
118+
run: |
119+
cd openwrt
120+
echo -e "$(nproc) thread compile"
121+
make -j$(nproc) V=99 2>&1 | tee build.log|| make -j2 V=99 2>&1 | tee build.log
122+
echo "::set-output name=status::success"
123+
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME
124+
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV
125+
echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
126+
127+
- name: Organize config and log files
128+
run: |
129+
cd openwrt
130+
mv .config ./bin/targets/x86/64/.config
131+
mv feeds.conf.default ./bin/targets/x86/64/feeds.conf.default
132+
mv download.log ./bin/targets/x86/64/download.log
133+
mv check.log ./bin/targets/x86/64/check.log
134+
mv build.log ./bin/targets/x86/64/build.log
135+
136+
- name: Check space usage
137+
if: (!cancelled())
138+
run: df -hT
139+
140+
- name: Upload bin directory
141+
uses: actions/upload-artifact@main
142+
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
143+
with:
144+
name: OpenWrt_bin${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
145+
path: openwrt/bin
146+
147+
- name: Organize files
148+
id: organize
149+
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
150+
run: |
151+
cd openwrt/bin/targets/*/*
152+
rm -rf packages
153+
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
154+
echo "::set-output name=status::success"
155+
156+
- name: Upload firmware directory
157+
uses: actions/upload-artifact@main
158+
if: steps.organize.outputs.status == 'success' && !cancelled()
159+
with:
160+
name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
161+
path: ${{ env.FIRMWARE }}
162+
163+
- name: Upload firmware to cowtransfer
164+
id: cowtransfer
165+
if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled()
166+
run: |
167+
curl -fsSL git.io/file-transfer | sh
168+
./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log
169+
echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)"
170+
echo "::set-output name=url::$(cat cowtransfer.log | grep https | cut -f3 -d" ")"
171+
172+
- name: Upload firmware to WeTransfer
173+
id: wetransfer
174+
if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled()
175+
run: |
176+
curl -fsSL git.io/file-transfer | sh
177+
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log
178+
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)"
179+
echo "::set-output name=url::$(cat wetransfer.log | grep https | cut -f3 -d" ")"
180+
181+
- name: Generate release tag
182+
id: tag
183+
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
184+
run: |
185+
echo "::set-output name=release_tag::$(date +"%Y.%m.%d-%H%M")"
186+
touch release.txt
187+
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt
188+
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt
189+
echo "::set-output name=status::success"
190+
191+
- name: Upload firmware to release
192+
uses: softprops/action-gh-release@v1
193+
if: steps.tag.outputs.status == 'success' && !cancelled()
194+
env:
195+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
196+
with:
197+
tag_name: ${{ steps.tag.outputs.release_tag }}
198+
body_path: release.txt
199+
files: ${{ env.FIRMWARE }}/*
200+
201+
- name: Delete workflow runs
202+
uses: GitRML/delete-workflow-runs@main
203+
with:
204+
retain_days: 1
205+
keep_minimum_runs: 3
206+
207+
- name: Remove old Releases
208+
uses: dev-drprasad/delete-older-releases@v0.1.0
209+
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
210+
with:
211+
keep_latest: 7
212+
delete_tags: true
213+
env:
214+
GITHUB_TOKEN: ${{ secrets.TOKEN }}
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#
1+
#
22
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
33
#
44
# This is free software, licensed under the MIT License.
@@ -8,7 +8,7 @@
88
# Description: Build OpenWrt using GitHub Actions
99
#
1010

11-
name: j1900_x86 OpenWrt
11+
name: j1900_simple OpenWrt
1212

1313
on:
1414
push:
@@ -30,7 +30,7 @@ env:
3030
REPO_URL: https://www.github.com/openwrt/openwrt
3131
REPO_BRANCH: master
3232
FEEDS_CONF: feeds.conf.default
33-
CONFIG_FILE: config/j1900.config
33+
CONFIG_FILE: config/j1900s.config
3434
DIY_P1_SH: diyJ1900-part1.sh
3535
DIY_P2_SH: diyJ1900-part2.sh
3636
UPLOAD_BIN_DIR: true
@@ -87,6 +87,7 @@ jobs:
8787
chmod +x $DIY_P2_SH
8888
cd openwrt
8989
$GITHUB_WORKSPACE/$DIY_P2_SH
90+
9091
- name: SSH connection to Actions
9192
uses: P3TERX/ssh2actions@v1.0.0
9293
if: (github.event.inputs.ssh == 'true' && github.event.inputs.ssh != 'false') || contains(github.event.action, 'ssh')

0 commit comments

Comments
 (0)