-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (113 loc) · 3.91 KB
/
build.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
#
# This is free software, licence use MIT.
#
# Copyright (C) 2019 P3TERX <https://p3terx.com>
# Copyright (C) 2020 KFERMercer <KFER.Mercer@gmail.com>
# Copyright (C) 2024 Muhan Li <limuhan@msn.com>
#
# <https://github.com/muhac/openwrt-action>
#
name: Build OpenWrt
on:
push:
branches:
- '**'
# schedule:
# - cron: 0 0 * * SAT
release:
types:
- published
jobs:
build_openwrt:
name: Build OpenWrt Firmware
runs-on: ubuntu-latest
if: github.event.repository.owner.id == github.event.sender.id
steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v4
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
- name: Check free space
run: df -Th
# Recommended package prerequisites
# https://openwrt.org/docs/guide-developer/toolchain/install-buildsystem#debianubuntu
- name: Initialization
run: |
sudo apt-get update
sudo apt-get install -y build-essential clang flex bison g++ gawk \
gcc-multilib g++-multilib gettext git libncurses-dev libssl-dev \
python3-setuptools mkisofs rsync unzip zlib1g-dev file wget qemu-utils
sudo apt-get clean
- name: Load settings
run: cp -r ./settings ../settings
# Set the upstream repo and a branch or tag
- name: OpenWrt source code
uses: actions/checkout@v4
with:
repository: 'openwrt/openwrt'
ref: 'v24.10.0'
- name: Configure basic packages
run: bash ../settings/basic.sh
- name: Configure extra packages
run: bash ../settings/extra.sh
- name: Configuration settings
run: cat ../settings/system.conf
- name: Update feeds
run: |
./scripts/feeds update -a
./scripts/feeds install -a
- name: Generate config
run: |
rm -f ./.config*
cp ../settings/system.conf ./.config
make defconfig
- name: Overwrite config
run: bash ../settings/system.sh
- name: Check build config
run: cat ./.config
- name: Check system config
run: cat ./package/base-files/files/bin/config_generate
- name: Make download
run: make download -j$(nproc) || make download -j1 V=s
- name: Compile firmware
run: make -j$(nproc) || make -j1 V=s
- name: Build results
run: tree -a ./bin/targets/
- name: Space usage
run: du -h ./ --max-depth=1
- name: Disk space remaining
run: df -h
- name: Prepare artifact
run: |
echo "now=$(date '+%Y%m%d_%H%M%S')" >> $GITHUB_ENV
mkdir -p ./artifact/firmware
mkdir -p ./artifact/package
mkdir -p ./artifact/buildinfo
rm -rf $(find ./bin/targets/ -type d -name "packages")
cp -rf $(find ./bin/targets/ -type f) ./artifact/firmware/
cp -rf $(find ./bin/packages/ -type f -name "*.ipk") ./artifact/package/
cp -rf $(find ./bin/targets/ -type f -name "*.buildinfo" -o -name "*.manifest") ./artifact/buildinfo/
- name: Deliver buildinfo
uses: actions/upload-artifact@v4
with:
name: OpenWrt_buildinfo_${{ github.ref_name }}_${{ env.now }}
path: ./artifact/buildinfo/
- name: Deliver package
uses: actions/upload-artifact@v4
with:
name: OpenWrt_package_${{ github.ref_name }}_${{ env.now }}
path: ./artifact/package/
- name: Deliver firmware
uses: actions/upload-artifact@v4
with:
name: OpenWrt_firmware_${{ github.ref_name }}_${{ env.now }}
path: ./artifact/firmware/
- name: Upload release asset
if: github.event_name == 'release'
uses: svenstaro/upload-release-action@v2
with:
file: ./artifact/firmware/*
tag: ${{ github.ref }}
file_glob: true