-
Notifications
You must be signed in to change notification settings - Fork 0
225 lines (196 loc) · 7.57 KB
/
AutoBuildLede.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
name: Auto Build Lede
on:
repository_dispatch:
env:
REPO_URL: https://github.com/coolsnowwolf/lede
REPO_BRANCH: master
CONFIG_FILE: .config
DIY_SH: diy.sh
UPLOAD_BIN_DIR: false
UPLOAD_FIRMWARE: true
UPLOAD_COWTRANSFER: false
UPLOAD_WETRANSFER: false
UPLOAD_RELEASE: false
TZ: Asia/Shanghai
jobs:
build:
runs-on: ubuntu-latest
permissions:
actions: write
name: Build ${{matrix.target}}
strategy:
fail-fast: false
matrix:
target: ["${{ github.event.client_payload.target }}"]
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: true
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: true
- name: Disk space
run: |
echo "Free space:"
df -h
- name: Checkout
uses: actions/checkout@main
with:
fetch-depth: 0
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt -qq update
sudo -E apt -qq full-upgrade -y
sudo -E apt -qq install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext \
genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev \
libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev \
libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf \
python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion \
swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
sudo -E apt -qq purge azure-cli ghc* zulu* llvm* firefox powershell openjdk* dotnet* google* mysql* php* android*
sudo rm -rf /etc/apt/sources.list.d/* /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo -E apt -qq autoremove --purge
sudo -E apt -qq clean
sudo timedatectl set-timezone "$TZ"
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: Clone Source Code
working-directory: /workdir
run: |
df -hT $PWD
git clone $REPO_URL -b $REPO_BRANCH lede
ln -sf /workdir/lede $GITHUB_WORKSPACE/lede
- name: Load Custom feeds
run: |
cp -rf devices lede/
cd lede
chmod +x devices/common/$DIY_SH
/bin/bash "devices/common/$DIY_SH"
cat feeds.conf.default
- name: Update feeds
run: cd lede && ./scripts/feeds update -a
- name: Install feeds
run: cd lede && ./scripts/feeds install -a
- name: Load Custom Configuration
run: |
cd lede
cp -f devices/common/$CONFIG_FILE .config
if [ -f "devices/${{matrix.target}}/$CONFIG_FILE" ]; then
echo >> .config
cat devices/${{matrix.target}}/$CONFIG_FILE >> .config
fi
if [ -f "devices/${{matrix.target}}/$DIY_SH" ]; then
chmod +x devices/${{matrix.target}}/$DIY_SH
echo "/bin/bash devices/${{matrix.target}}/$DIY_SH"
/bin/bash "devices/${{matrix.target}}/$DIY_SH"
fi
- name: Defconfig
id: defconfig
run: |
cd lede
make defconfig
cat .config
- name: Download Package
id: package
run: |
cd lede
make download -j$(nproc)
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Setup Tmate Session
uses: mxschmitt/action-tmate@v3
if: contains(github.event.action, 'ssh')
- name: Compile the Firmware
id: compile
run: |
cd lede
echo -e "$(nproc) thread compile"
make -j$(nproc) || make -j1 || make -j1 V=s
echo "status=success" >> $GITHUB_OUTPUT
echo "Compilation successful"
echo "MATRIX_TARGET=${{ matrix.target }}" >> $GITHUB_ENV
echo "FILE_DATE=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: Check Space Usage
if: (!cancelled())
run: df -hT
- name: Upload bin Directory
uses: actions/upload-artifact@main
if: steps.compile.outputs.status == 'success' && env.UPLOAD_BIN_DIR == 'true'
with:
name: lede_bin_${{ env.MATRIX_TARGET }}_${{ env.FILE_DATE }}
path: lede/bin
- name: Organize Files
id: organize
if: env.UPLOAD_FIRMWARE == 'true' && !cancelled()
run: |
cd lede/bin/targets/*/*
rm -rf packages
echo "FIRMWARE=$PWD" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
echo "organize_status = success"
- name: Upload Firmware Directory
uses: actions/upload-artifact@main
if: steps.organize.outputs.status == 'success' && !cancelled()
with:
name: lede_firmware_${{ env.MATRIX_TARGET }}_${{ env.FILE_DATE }}
path: ${{ env.FIRMWARE }}
- name: Upload Firmware to Cowtransfer
id: cowtransfer
if: steps.organize.outputs.status == 'success' && env.UPLOAD_COWTRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer cow --block 2621440 -s -p 64 --no-progress ${FIRMWARE} 2>&1 | tee cowtransfer.log
echo "::warning file=cowtransfer.com::$(cat cowtransfer.log | grep https)"
echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT
echo "url=$(cat cowtransfer.log | grep https | cut -f3 -d" ")"
- name: Upload Firmware to WeTransfer
id: wetransfer
if: steps.organize.outputs.status == 'success' && env.UPLOAD_WETRANSFER == 'true' && !cancelled()
run: |
curl -fsSL git.io/file-transfer | sh
./transfer wet -s -p 16 --no-progress ${FIRMWARE} 2>&1 | tee wetransfer.log
echo "::warning file=wetransfer.com::$(cat wetransfer.log | grep https)"
echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")" >> $GITHUB_OUTPUT
echo "url=$(cat wetransfer.log | grep https | cut -f3 -d" ")"
- name: Generate Release Tag
id: tag
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
run: |
echo "release_tag=$(date +"%Y.%m.%d-%H%M")" >> $GITHUB_OUTPUT
touch release.txt
[ $UPLOAD_COWTRANSFER = true ] && echo "🔗 [Cowtransfer](${{ steps.cowtransfer.outputs.url }})" >> release.txt
[ $UPLOAD_WETRANSFER = true ] && echo "🔗 [WeTransfer](${{ steps.wetransfer.outputs.url }})" >> release.txt
echo "status=success" >> $GITHUB_OUTPUT
echo "release_status = success"
- name: Upload Firmware to Release
uses: softprops/action-gh-release@v1
if: steps.tag.outputs.status == 'success' && !cancelled()
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}
with:
tag_name: ${{ steps.tag.outputs.release_tag }}
body_path: release.txt
files: ${{ env.FIRMWARE }}/*
- name: Delete Workflow Runs
uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: 3
keep_minimum_runs: 0
- name: Remove old Releases
uses: dev-drprasad/[email protected]
if: env.UPLOAD_RELEASE == 'true' && !cancelled()
with:
keep_latest: 3
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}