-
Notifications
You must be signed in to change notification settings - Fork 8
233 lines (216 loc) · 11.6 KB
/
Copy pathbuild-x86-64-24.10.5.yml
File metadata and controls
233 lines (216 loc) · 11.6 KB
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
226
227
228
229
230
231
232
233
name: build-x86-64-immortalwrt-24.10.5
on:
repository_dispatch:
types: [immortalwrt-update-2410]
workflow_dispatch:
inputs:
profile:
description: '请输入要编译固件大小 单位 (MB)'
required: true
default: '4096'
include_docker:
description: |
是否编译 Docker 插件
required: true
default: 'no'
type: choice
options:
- 'yes'
- 'no'
enable_pppoe:
description: "是否配置 PPPoE 拨号信息?"
required: true
default: 'no'
type: choice
options:
- 'yes'
- 'no'
pppoe_account:
description: "宽带账号 (若启用 PPPoE)"
required: false
default: '123456'
pppoe_password:
description: "宽带密码 (若启用 PPPoE)"
required: false
default: '123456'
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set executable permissions
run: chmod +x ${{ github.workspace }}/x86-64/build.sh
- name: Set default values if inputs are not provided
run: |
if [ -z "${{ github.event.inputs.profile }}" ]; then
echo "profile=${{ github.event.inputs.profile.default || '4096' }}" >> $GITHUB_ENV
else
echo "profile=${{ github.event.inputs.profile }}" >> $GITHUB_ENV
fi
if [ -z "${{ github.event.inputs.include_docker }}" ]; then
echo "include_docker=${{ github.event.inputs.include_docker.default || 'yes' }}" >> $GITHUB_ENV
else
echo "include_docker=${{ github.event.inputs.include_docker }}" >> $GITHUB_ENV
fi
if [ -z "${{ github.event.inputs.enable_pppoe }}" ]; then
echo "enable_pppoe=${{ github.event.inputs.enable_pppoe.default || 'no' }}" >> $GITHUB_ENV
else
echo "enable_pppoe=${{ github.event.inputs.enable_pppoe }}" >> $GITHUB_ENV
fi
if [ -z "${{ github.event.inputs.pppoe_account }}" ]; then
echo "pppoe_account=${{ github.event.inputs.pppoe_account.default || '123456' }}" >> $GITHUB_ENV
else
echo "pppoe_account=${{ github.event.inputs.pppoe_account }}" >> $GITHUB_ENV
fi
if [ -z "${{ github.event.inputs.pppoe_password }}" ]; then
echo "pppoe_password=${{ github.event.inputs.pppoe_password.default || '123456' }}" >> $GITHUB_ENV
else
echo "pppoe_password=${{ github.event.inputs.pppoe_password }}" >> $GITHUB_ENV
fi
- name: Build ImmortalWrt-x86-64-EFI
run: |
profiles="${{ env.profile }}"
include_docker="${{ env.include_docker }}"
enable_pppoe="${{ env.enable_pppoe }}"
pppoe_account="${{ env.pppoe_account }}"
pppoe_password="${{ env.pppoe_password }}"
IFS=',' read -r -a profile_array <<< "$profiles"
for profile in "${profile_array[@]}"; do
echo "Building for profile: $profile"
docker run --rm -i \
--user root \
-v "${{ github.workspace }}/bin:/home/build/immortalwrt/bin" \
-v "${{ github.workspace }}/files:/home/build/immortalwrt/files" \
-v "${{ github.workspace }}/x86-64/immortalwrt.config:/home/build/immortalwrt/.config" \
-v "${{ github.workspace }}/shell:/home/build/immortalwrt/shell" \
-v "${{ github.workspace }}/x86-64/build.sh:/home/build/immortalwrt/build.sh" \
-e PROFILE=$profile \
-e INCLUDE_DOCKER=$include_docker \
-e ENABLE_PPPOE=$enable_pppoe \
-e PPPOE_ACCOUNT=$pppoe_account \
-e PPPOE_PASSWORD=$pppoe_password \
immortalwrt/imagebuilder:x86-64-openwrt-24.10.5 /bin/bash /home/build/immortalwrt/build.sh
done
- name: Generate Firmware SHA-256
run: |
cp ${{ github.workspace }}/bin/targets/x86/64/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz ${{ github.workspace }}
SHA_TMP="`cat ${{ github.workspace }}/bin/targets/x86/64/sha256sums | grep 'immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz' | awk '{print $1}'`"
echo $SHA_TMP *immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz > ${{ github.workspace }}/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz.sha256
- name: Generate release tag
id: tag
run: |
SHA_TMP="`cat ${{ github.workspace }}/bin/targets/x86/64/sha256sums | grep 'immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz' | awk '{print $1}'`"
FILE_SIZE=$(du -b "${{ github.workspace }}/bin/targets/x86/64/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz" | awk '{print $1}')
FILE_SIZE_MB=$(awk -v size="$FILE_SIZE" 'BEGIN { printf "%.2f", size / (1024 * 1024) }')
RELEASE_TAG=$(date +"%Y.%m.%d-%H%M")
CURRENT_DATE=$(TZ='Asia/Shanghai' date "+%a, %b %-e, %Y %H:%M:%S GMT+8")
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_OUTPUT
touch release.txt
echo -e "### 📦️ ImmortalWrt 24.10.5 x86-64\n" >> release.txt
echo -e "The current ImmortalWrt build is linked below. It is adviced to use the latest available release if possible.\n" >> release.txt
echo "| Meta | Detail |" >> release.txt
echo "| --- | --- |" >> release.txt
echo -e "| Trigger | ${{
github.event_name == 'repository_dispatch' && github.event.client_payload.webhook_message ||
github.event_name == 'workflow_dispatch' && 'Manual' ||
github.event_name == 'push' && 'Push' ||
github.event_name == 'schedule' && 'Schedule' ||
'Unknown'
}} |" >> release.txt
echo -e "| Image | ⬇️ [immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz](https://github.com/eallion/openwrt/releases/download/"$RELEASE_TAG"/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz) |" >> release.txt
echo -e "| Sha256 | "$SHA_TMP" |" >> release.txt
echo -e "| Date | $CURRENT_DATE |" >> release.txt
if [[ "${{ github.event_name }}" == "repository_dispatch" && ! -z "${{ github.event.client_payload.webhook_message }}" ]]; then
# Convert message to lowercase, remove quotes, spaces, and "updated" word
MESSAGE=$(echo "${{ github.event.client_payload.webhook_message }}" | tr '[:upper:]' '[:lower:]' | tr -d '"' | tr -d ' ' | sed 's/updated//g')
case "$MESSAGE" in
ddns-go|ddnsgo)
echo -e "| Source | [https://github.com/jeessy2/ddns-go](https://github.com/jeessy2/ddns-go) |" >> release.txt
;;
cloudflared)
echo -e "| Source | [https://github.com/cloudflare/cloudflared](https://github.com/cloudflare/cloudflared) |" >> release.txt
;;
immortalwrt)
echo -e "| Source | [https://github.com/immortalwrt/immortalwrt/tree/openwrt-24.10](https://github.com/immortalwrt/immortalwrt/tree/openwrt-24.10) |" >> release.txt
;;
homeproxy)
echo -e "| Source | [https://github.com/immortalwrt/homeproxy](https://github.com/immortalwrt/homeproxy) |" >> release.txt
;;
*)
echo -e "| Source | [https://github.com/immortalwrt/immortalwrt/tree/openwrt-24.10](https://github.com/immortalwrt/immortalwrt/tree/openwrt-24.10) |" >> release.txt
;;
esac
else
echo -e "| Source | [https://github.com/immortalwrt/immortalwrt/tree/openwrt-24.10](https://github.com/immortalwrt/immortalwrt/tree/openwrt-24.10) |" >> release.txt
fi
echo -e "| Branch | openwrt-24.10 |" >> release.txt
echo -e "| Architecture | x86-64 |" >> release.txt
echo -e "| FS | squashfs |" >> release.txt
echo -e "| FI | EFI |" >> release.txt
echo -e "| Size | "$FILE_SIZE_MB" MB |" >> release.txt
echo -e "| Default IP | 192.168.0.1 |\n" >> release.txt
cp release.txt email_body.md
sed -i "s|$SHA_TMP|<code>$SHA_TMP<\/code>|g" release.txt
sed -i 's/192.168.0.1/<code>192.168.0.1<\/code>/g' release.txt
echo -e "### ✅ Check sha256sums\n" >> release.txt
echo -e '> Perhaps need to [download](https://github.com/eallion/openwrt/releases/download/"$RELEASE_TAG"/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz) first:\n' >> release.txt
echo '```bash' >> release.txt
echo "wget https://github.com/eallion/openwrt/releases/download/"$RELEASE_TAG"/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz" >> release.txt
echo -e '```\n' >> release.txt
echo -e 'One-click verification. Output `OK` to true:\n' >> release.txt
echo '```bash' >> release.txt
echo -e "echo \"$SHA_TMP *immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz\" | shasum -a 256 --check\n" >> release.txt
echo -e '# immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz: OK' >> release.txt
echo -e '```\n' >> release.txt
echo -e '### 🗃️ ImmortalWrt Downloads Archive\n' >> release.txt
echo -e "- [**downloads.immortalwrt.org**](https://downloads.immortalwrt.org/)" >> release.txt
echo "status=success" >> $GITHUB_OUTPUT
- name: Upload ImmortWrt as release assets
uses: softprops/action-gh-release@v2
if: steps.tag.outputs.status == 'success' && !cancelled()
with:
tag_name: ${{ steps.tag.outputs.RELEASE_TAG }}
body_path: release.txt
files: |
${{ github.workspace }}/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz
${{ github.workspace }}/immortalwrt-x86-64-generic-squashfs-combined-efi.img.gz.sha256
token: ${{ secrets.TOKEN_FOR_OPENWRT }}
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_FOR_OPENWRT }}
- name: Send mail
uses: dawidd6/action-send-mail@v4
if: steps.tag.outputs.status == 'success' && !cancelled()
with:
# Specify connection via URL (replaces server_address, server_port, secure,
# username and password)
#
# Format:
#
# * smtp://user:password@server:port
# * smtp+starttls://user:password@server:port
# connection_url: ${{secrets.MAIL_CONNECTION}}
# Required mail server address if not connection_url:
server_address: mail.smtp2go.com
# Server port, default 25:
server_port: 465
# Optional whether this connection use TLS (default is true if server_port is 465)
secure: true
# Optional (recommended) mail server username:
username: ${{secrets.MAIL_USERNAME}}
# Optional (recommended) mail server password:
password: ${{secrets.MAIL_PASSWORD}}
# Required mail subject:
subject: ImmortalWrt Build Successful
# Required recipients' addresses:
to: eallion.s+github@gmail.com
# Required sender full name (address can be skipped):
from: ImmortalWrt Build
# Optional plain body:
# body: Build job of ${{github.repository}} completed successfully!
# Optional HTML body read from file:
html_body: file://email_body.md
# Optional unsigned/invalid certificates allowance:
ignore_cert: true
# Optional converting Markdown to HTML (set content_type to text/html too):
convert_markdown: true