Unverified Commit 902cc80d authored by wukongdaily's avatar wukongdaily Committed by GitHub
Browse files

Update build.yml

parent 63cfd9b6
name: ImmortalWrt Build
name: build-x86-64-Release
on:
workflow_dispatch:
inputs:
profile:
description: '手动输入的多个 profile,并按逗号分隔'
required: true
default: 'generic'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
......@@ -15,23 +21,55 @@ jobs:
- name: Setup Docker and Build
run: |
profiles="${{ github.event.inputs.profile }}"
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 }}/Makefile:/home/build/immortalwrt/target/linux/x86/Makefile" \
-v "${{ github.workspace }}/build.sh:/home/build/immortalwrt/build.sh" \
immortalwrt/imagebuilder:x86-64-openwrt-23.05.4 /bin/sh /home/build/immortalwrt/build.sh
-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 firmware file
id: locate_file
- name: Locate squashfs firmware files
id: locate_files
run: |
firmware_file=$(find "${{ github.workspace }}/bin" -name '*squashfs-combined-efi.img.gz' | head -n 1)
echo "Firmware file located at $firmware_file"
echo "firmware_path=$firmware_file" >> $GITHUB_ENV
- name: Upload firmware
# 查找符合条件的固件文件
firmware_files=$(find "${{ github.workspace }}/bin" -type f -name '*squashfs-combined*.img.gz')
# 格式化路径,以避免多余的换行或空格
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
with:
name: firmware
path: ${{ env.firmware_path }}
path: ${{ env.firmware_paths }}
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment