Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
mgqnfoqv7k2w
AutoBuildImmortalWrt
Commits
902cc80d
Unverified
Commit
902cc80d
authored
Dec 08, 2024
by
wukongdaily
Committed by
GitHub
Dec 08, 2024
Browse files
Update build.yml
parent
63cfd9b6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
16 deletions
+54
-16
.github/workflows/build.yml
.github/workflows/build.yml
+54
-16
No files found.
.github/workflows/build.yml
View file @
902cc80d
name
:
ImmortalWrt Build
name
:
build-x86-64-Release
on
:
on
:
workflow_dispatch
:
workflow_dispatch
:
inputs
:
profile
:
description
:
'
手动输入的多个
profile,并按逗号分隔'
required
:
true
default
:
'
generic'
jobs
:
jobs
:
build
:
build
:
runs-on
:
ubuntu-latest
runs-on
:
ubuntu-latest
steps
:
steps
:
-
name
:
Checkout code
-
name
:
Checkout code
uses
:
actions/checkout@v3
uses
:
actions/checkout@v3
...
@@ -15,23 +21,55 @@ jobs:
...
@@ -15,23 +21,55 @@ jobs:
-
name
:
Setup Docker and Build
-
name
:
Setup Docker and Build
run
:
|
run
:
|
docker run --rm -i \
profiles="${{ github.event.inputs.profile }}"
--user root \
-v "${{ github.workspace }}/bin:/home/build/immortalwrt/bin" \
IFS=',' read -r -a profile_array <<< "$profiles"
-v "${{ github.workspace }}/files:/home/build/immortalwrt/files" \
-v "${{ github.workspace }}/Makefile:/home/build/immortalwrt/target/linux/x86/Makefile" \
for profile in "${profile_array[@]}"; do
-v "${{ github.workspace }}/build.sh:/home/build/immortalwrt/build.sh" \
echo "Building for profile: $profile"
immortalwrt/imagebuilder:x86-64-openwrt-23.05.4 /bin/sh /home/build/immortalwrt/build.sh
docker run --rm -i \
-
name
:
Locate firmware file
--user root \
id
:
locate_file
-v "${{ github.workspace }}/bin:/home/build/immortalwrt/bin" \
-v "${{ github.workspace }}/files:/home/build/immortalwrt/files" \
-v "${{ github.workspace }}/x86-64/imm.config:/home/build/immortalwrt/.config" \
-v "${{ github.workspace }}/x86-64/build.sh:/home/build/immortalwrt/build.sh" \
-e PROFILE=$profile \
immortalwrt/imagebuilder:x86-64-openwrt-23.05.4 /bin/bash /home/build/immortalwrt/build.sh
done
-
name
:
Locate squashfs firmware files
id
:
locate_files
run
:
|
run
:
|
firmware_file=$(find "${{ github.workspace }}/bin" -name '*squashfs-combined-efi.img.gz' | head -n 1)
# 查找符合条件的固件文件
echo "Firmware file located at $firmware_file"
firmware_files=$(find "${{ github.workspace }}/bin" -type f -name '*squashfs-combined*.img.gz')
echo "firmware_path=$firmware_file" >> $GITHUB_ENV
# 格式化路径,以避免多余的换行或空格
-
name
:
Upload firmware
firmware_files=$(echo "$firmware_files" | tr '\n' ' ')
echo "Squashfs firmware files located: $firmware_files"
echo "firmware_paths=$firmware_files" >> $GITHUB_ENV
-
name
:
Upload firmware to GitHub Artifact
uses
:
actions/upload-artifact@v4
uses
:
actions/upload-artifact@v4
with
:
with
:
name
:
firmware
name
:
firmware
path
:
${{ env.firmware_path }}
path
:
${{ env.firmware_path
s
}}
compression-level
:
0
compression-level
:
0
-
name
:
Create GitHub Release
id
:
create_release
uses
:
actions/create-release@v1
with
:
tag_name
:
v1.0.0
# 你可以使用动态版本号或者手动指定版本
release_name
:
"
Release
v1.0.0"
draft
:
false
prerelease
:
false
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
# 使用 GitHub Token
-
name
:
Upload firmware to GitHub Release
uses
:
actions/upload-release-asset@v1
with
:
url
:
${{ steps.create_release.outputs.upload_url }}
asset_path
:
${{ env.firmware_paths }}
# 直接传递固件路径
asset_name
:
firmware.img.gz
# 文件名会自动根据文件类型选择
asset_content_type
:
application/gzip
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment