generated from P3TERX/Actions-OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 3
156 lines (135 loc) · 4.6 KB
/
x86.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
147
148
149
150
151
152
153
154
155
156
#
# Copyright (c) 2019-2020 P3TERX <https://p3terx.com>
#
# This is free software, licensed under the MIT License.
# See /LICENSE for more information.
#
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Build OpenWrt using GitHub Actions
#
name: Build OpenWrt(x86)
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: '22 16 * * 2,4'
env:
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: x86
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
echo $(nproc)
free -h
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt-get -qq update
sudo -E apt-get -qq install sudo time git-core subversion build-essential gcc-multilib libncurses5-dev zlib1g-dev gawk flex gettext wget unzip grep rsync python3 tree python3-distutils
sudo -E apt-get -qq clean
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: Clone source code
# working-directory: /workdir
run: |
pwd
git clone -b openwrt-23.05 --single-branch --depth=1 https://github.com/immortalwrt/immortalwrt openwrt
# ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
ls -l
# 插件包,不要可用注释
- name: feeds add kenzok8-package
run: |
cd openwrt
sed -i '$a src-git kenzo https://github.com/kenzok8/openwrt-packages' feeds.conf.default
sed -i '$a src-git small https://github.com/kenzok8/small' feeds.conf.default
# - name: feeds add fw876/helloworld
# run: |
# cd openwrt
# sed -i "/helloworld/d" "feeds.conf.default"
# echo "src-git helloworld https://github.com/fw876/helloworld.git" >> "feeds.conf.default"
- name: feeds init and download
run: |
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
- name: .config file init
run: |
cp ./.config openwrt/.config
cd openwrt
rm -rf ./bin ./build_dir ./tmp
make defconfig
cat ./.config
# - name: Cache Hook
# uses: actions/cache@v3
# with:
# path: |
# openwrt/bin
# openwrt/build_dir
# openwrt/staging_dir
# openwrt/tmp
# key: cache_x86_${{ hashFiles('openwrt/.config') }}
# restore-keys: |
# cache_x86_
# cache_x86
- name: .config file bak
run: |
mkdir ./bin
cp ./.config ./bin/config.bak
- name: Change IP to..192.168.8.1
run: |
cd openwrt
sed -i "s/192.168.1.1/192.168.8.1/" package/base-files/files/bin/config_generate
cat package/base-files/files/bin/config_generate|grep lan\)
- name: make
run: |
cd openwrt
find ./ -name *gcc
make download -j8
rm -rf build.log
# | grep -i error
make -j$(expr $(nproc) + 12) V=99 2>&1 | tee build.log | grep -i error
cp build.log ./bin
grep '^CONFIG_TARGET.*DEVICE.*=y' .config | sed -r 's/.*DEVICE_(.*)=y/\1/' > DEVICE_NAME
[ -s DEVICE_NAME ] && echo "DEVICE_NAME=_$(cat DEVICE_NAME)" >> $GITHUB_ENV
echo "FILE_DATE=_$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: FIRMWARE set path
id: organize
run: |
cd openwrt/bin/
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
- name: Artifacts File Save
uses: actions/upload-artifact@main
with:
name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
path: ${{ env.FIRMWARE }}
- name: Release set path
run: |
touch release.txt
cd openwrt/bin/targets/*/*
echo "RELEASE_PATH=$PWD" >> $GITHUB_ENV
- name: pack bin dir
run: |
cd openwrt
tar -zcvf bin_dir.tar.gz ./bin/
mv bin_dir.tar.gz ${{ env.RELEASE_PATH }}/
rm -rf ${{ env.RELEASE_PATH }}/packages
- name: pack dl dir
run: |
cd openwrt
tar -zcvf dl.tar.gz ./dl/
mv dl.tar.gz ${{ env.RELEASE_PATH }}/
- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: OpenWrt_firmware${{ env.DEVICE_NAME }}${{ env.FILE_DATE }}
body_path: release.txt
files: ${{ env.RELEASE_PATH }}/*