Skip to content

build-x86-64-immortalwrt-24.10 #6

build-x86-64-immortalwrt-24.10

build-x86-64-immortalwrt-24.10 #6

name: build-x86-64-immortalwrt-24.10
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@v6
- 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.6 /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 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" >> 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@v3
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@v16
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 <${{secrets.MAIL_USERNAME}}>'
# 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