generated from P3TERX/Actions-OpenWrt
-
Notifications
You must be signed in to change notification settings - Fork 16
153 lines (133 loc) · 4.89 KB
/
build-23.05.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
name: OpenWrt 23.05 Builder
on:
workflow_dispatch:
repository_dispatch:
types: [openwrt-23.05]
env:
REPO_URL: https://github.com/immortalwrt/immortalwrt
REPO_BRANCH: openwrt-23.05
TZ: Asia/Shanghai
jobs:
OpenWrt_Builder:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
info:
- '{ "TYPE": "router", "DIY_P1_SH": "diy-part1.sh", "DIY_P2_SH": "diy-part2-router.sh" }'
- '{ "TYPE": "gateway", "DIY_P1_SH": "diy-part1.sh", "DIY_P2_SH": "diy-part2-gateway.sh"}'
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{env.REPO_BRANCH}}
- name: Check space usage
if: (!cancelled())
run: df -hT
- name: Free disk space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Check space usage
if: (!cancelled())
run: df -hT
- name: Initialization environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo -E apt-get -qq update
sudo bash -c 'bash <(curl -s https://build-scripts.immortalwrt.org/init_build_environment.sh)'
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
sudo timedatectl set-timezone ${{env.TZ}}
sudo mkdir -p /workdir
sudo chown $USER:$GROUPS /workdir
- name: Clone source code
working-directory: /workdir
run: |
df -hT $PWD
git clone -b ${{env.REPO_BRANCH}} --single-branch --depth 1 ${{env.REPO_URL}} openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
- name: Load custom feeds
run: |
chmod +x ${{fromJSON(matrix.info).DIY_P1_SH}}
cd openwrt
$GITHUB_WORKSPACE/${{fromJSON(matrix.info).DIY_P1_SH}}
- name: Update feeds
run: cd openwrt && ./scripts/feeds update -a
- name: Install feeds
run: cd openwrt && ./scripts/feeds install -a
- name: Generate default configuration
run: cd openwrt && make defconfig
- name: Load custom configuration
run: |
chmod +x ${{fromJSON(matrix.info).DIY_P2_SH}}
cd openwrt
$GITHUB_WORKSPACE/${{fromJSON(matrix.info).DIY_P2_SH}}
- name: Download package
id: package
run: |
cd openwrt
make defconfig
make download -j8
find dl -size -1024c -exec ls -l {} \;
find dl -size -1024c -exec rm -f {} \;
- name: Compile the firmware
id: compile
run: |
cd openwrt
echo -e "$(($(nproc) + 1)) thread compile"
make -j$(($(nproc) + 1)) V=s || make -j1 || make -j1 V=s
echo "status=success" >> $GITHUB_OUTPUT
echo "COMPILE_DATE=$(date +"%Y%m%d")" >> $GITHUB_ENV
echo "COMPILE_TIME=$(date +"%Y%m%d%H%M")" >> $GITHUB_ENV
- name: Check space usage
if: (!cancelled())
run: df -hT
- name: Organize compiled firmware
if: steps.compile.outputs.status == 'success' && !cancelled()
run: |
cp -rf openwrt/.config openwrt/bin/targets/x86/64/config
cd openwrt/bin/targets/x86/64
rm -rf *.buildinfo
rm -rf profiles.json
rm -rf sha256sums
rm -rf immortalwrt-x86-64-generic-kernel.bin
rm -rf immortalwrt-x86-64-generic.manifest
rm -rf immortalwrt-x86-64-generic-squashfs-rootfs.img.gz
mv config immortalwrt-${{fromJSON(matrix.info).TYPE}}.config
mv immortalwrt-x86-64-generic-rootfs.tar.gz immortalwrt-${{fromJSON(matrix.info).TYPE}}-generic-rootfs-x86_64-23.05-${{env.COMPILE_TIME}}.tar.gz
mv immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz immortalwrt-${{fromJSON(matrix.info).TYPE}}-generic-squashfs-combined-efi-x86_64-23.05-${{env.COMPILE_TIME}}.img.gz
- name: Upload firmware to release
if: steps.compile.outputs.status == 'success' && !cancelled()
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{secrets.GITHUB_TOKEN}}
file_glob: true
file: openwrt/bin/targets/x86/64/*
asset_name: ${{github.event.repository.name}}-${{github.sha}}
tag: immortalwrt-23.05-${{env.COMPILE_DATE}}
body: |
# IP
- immortalwrt-router: 192.168.3.1
- immortalwrt-gateway: 192.168.1.5
# username
- root
# password
- password
overwrite: true
Delete_Workflow:
needs: [ OpenWrt_Builder ]
runs-on: ubuntu-20.04
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@main
with:
retain_days: 0
keep_minimum_runs: 2