Skip to content

Commit e8de7ec

Browse files
committed
update devices
1 parent af5017b commit e8de7ec

File tree

6 files changed

+14039
-1
lines changed

6 files changed

+14039
-1
lines changed

.github/workflows/k2.yml

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
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: Build OpenWrt for K2P
12+
13+
on:
14+
repository_dispatch:
15+
workflow_dispatch:
16+
inputs:
17+
ssh:
18+
description: 'SSH connection to Actions'
19+
required: false
20+
default: 'false'
21+
22+
env:
23+
REPO_URL: https://github.com/openwrt/openwrt
24+
REPO_BRANCH: openwrt-23.05
25+
FEEDS_CONF: feeds.conf.k2
26+
CONFIG_FILE: k2.config
27+
DIY_P1_SH: diy-part1.sh
28+
DIY_P2_SH: diy-part2-k2.sh
29+
UPLOAD_BIN_DIR: false
30+
UPLOAD_FIRMWARE: true
31+
UPLOAD_COWTRANSFER: false
32+
UPLOAD_WETRANSFER: false
33+
UPLOAD_RELEASE: true
34+
TZ: Asia/Shanghai
35+
36+
jobs:
37+
build:
38+
runs-on: ubuntu-latest
39+
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@main
43+
44+
- name: Initialization environment
45+
env:
46+
DEBIAN_FRONTEND: noninteractive
47+
run: |
48+
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
49+
sudo -E apt-get -qq update
50+
sudo -E apt-get -qq install $(curl -fsSL git.io/depends-ubuntu-2004)
51+
sudo -E apt-get -qq autoremove --purge
52+
sudo -E apt-get -qq clean
53+
sudo timedatectl set-timezone "$TZ"
54+
sudo mkdir -p /workdir
55+
sudo chown $USER:$GROUPS /workdir
56+
57+
- name: Clone source code
58+
working-directory: /workdir
59+
run: |
60+
df -hT $PWD
61+
git clone $REPO_URL -b $REPO_BRANCH openwrt
62+
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
63+
64+
- name: Load custom feeds
65+
run: |
66+
[ -e $FEEDS_CONF ] && mv $FEEDS_CONF openwrt/feeds.conf.default
67+
chmod +x $DIY_P1_SH
68+
cd openwrt
69+
$GITHUB_WORKSPACE/$DIY_P1_SH
70+
71+
- name: Update feeds
72+
run: cd openwrt && ./scripts/feeds update -a
73+
74+
- name: Install feeds
75+
run: cd openwrt && ./scripts/feeds install -a
76+
77+
- name: Load custom configuration
78+
run: |
79+
[ -e files ] && mv files openwrt/files
80+
[ -e $CONFIG_FILE ] && mv $CONFIG_FILE openwrt/.config
81+
chmod +x $DIY_P2_SH
82+
cd openwrt
83+
$GITHUB_WORKSPACE/$DIY_P2_SH
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: Download package
93+
id: package
94+
run: |
95+
cd openwrt
96+
make defconfig
97+
make download -j8
98+
find dl -size -1024c -exec ls -l {} \;
99+
find dl -size -1024c -exec rm -f {} \;
100+
101+
- name: Compile the firmware
102+
id: compile
103+
run: |
104+
cd openwrt
105+
echo -e "$(nproc) thread compile"
106+
./scripts/feeds update -a && ./scripts/feeds install -a
107+
make -j$(nproc) || make -j1 || make -j1 V=s
108+
echo "::set-output name=status::success"
109+
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME
110+
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV
111+
echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
112+
113+
- name: Check space usage
114+
if: (!cancelled())
115+
run: df -hT
116+
117+
- name: Upload bin directory
118+
uses: actions/upload-artifact@main
119+
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
120+
with:
121+
name: OpenWrt_bin${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
122+
path: openwrt/bin
123+
124+
- name: Organize files
125+
id: organize
126+
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
127+
run: |
128+
cd openwrt/bin/targets/*/*
129+
rm -rf packages
130+
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
131+
echo "::set-output name=status::success"
132+
133+
- name: Upload firmware directory
134+
uses: actions/upload-artifact@main
135+
if: steps.organize.outputs.status == 'success' && !cancelled()
136+
with:
137+
name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
138+
path: ${{ env.FIRMWARE }}
139+
140+
- name: Upload firmware to cowtransfer
141+
id: cowtransfer
142+
if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled()
143+
run: |
144+
curl -fsSL git.io/file-transfer | sh
145+
./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log
146+
echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)"
147+
echo "::set-output name=url::$(cat cowtransfer.log | grep https | cut -f3 -d" ")"
148+
149+
- name: Upload firmware to WeTransfer
150+
id: wetransfer
151+
if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled()
152+
run: |
153+
curl -fsSL git.io/file-transfer | sh
154+
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log
155+
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)"
156+
echo "::set-output name=url::$(cat wetransfer.log | grep https | cut -f3 -d" ")"
157+
158+
- name: Generate release tag
159+
id: tag
160+
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
161+
run: |
162+
echo "::set-output name=release_tag::$(date +"%Y.%m.%d-%H%M")"
163+
touch release.txt
164+
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt
165+
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt
166+
echo "::set-output name=status::success"
167+
168+
- name: Upload firmware to release
169+
uses: softprops/action-gh-release@v1
170+
if: steps.tag.outputs.status == 'success' && !cancelled()
171+
env:
172+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+
with:
174+
tag_name: ${{ steps.tag.outputs.release_tag }}
175+
body_path: release.txt
176+
files: ${{ env.FIRMWARE }}/*
177+
178+
- name: Delete workflow runs
179+
uses: GitRML/delete-workflow-runs@main
180+
with:
181+
retain_days: 1
182+
keep_minimum_runs: 3
183+

.github/workflows/k2p-a1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121

2222
env:
2323
REPO_URL: https://github.com/openwrt/openwrt
24-
REPO_BRANCH: openwrt-21.02
24+
REPO_BRANCH: openwrt-23.05
2525
FEEDS_CONF: feeds.conf.k2p
2626
CONFIG_FILE: k2p-a1.config
2727
DIY_P1_SH: diy-part1.sh

0 commit comments

Comments
 (0)