Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Build Armbian All Borad #34

Build Armbian All Borad

Build Armbian All Borad #34

name: Build Armbian All Borad
on:
workflow_dispatch:
inputs:
BOARD:
description: 'Board type'
required: true
default: 'all'
type: choice
options:
- all
- fine3399
- fmx1-pro
- r08
- rock960
- sg2710
- tpm312
- tb-ls3399
- xiaobao-nas
- zysj
BRANCH:
description: 'Armbian branch'
default: 'current'
required: false
type: choice
options:
- current
- edge
RELEASE:
description: 'Release name'
default: 'bookworm'
required: true
type: choice
options:
- jammy
- bookworm
- noble
- bullseye
Version:
description: 'Armbian Version'
default: 'main'
required: false
type: choice
options:
- main
- v25.02
- v24.11
- v24.08
BUILD_DESKTOP:
description: 'Build desktop environment'
default: 'no'
required: false
type: choice
options:
- no
COMPRESS_OUTPUTIMAGE:
description: 'Compress output image'
default: 'sha,xz'
required: false
type: string
BOOT_LOGO:
description: 'Include boot logo'
default: 'yes'
required: false
type: choice
options:
- yes
- no
env:
TZ: America/New_York
jobs:
build-armbian:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialization environment
id: init
env:
DEBIAN_FRONTEND: noninteractive
run: |
# 清理 Docker 镜像和软件缓存
docker_images_ids=$(docker images -q)
if [ -n "$docker_images_ids" ]; then
docker rmi $docker_images_ids
fi
docker image prune -a -f
sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* openjdk* mysql* php* mongodb* dotnet* moby* snapd* android* || true
sudo -E apt-get -qq autoremove --purge
sudo -E apt-get -qq clean
# 安装兼容的 Python 版本(如 Python 3.10)
sudo -E apt-get install -y python3-distutils python3-pip python3-setuptools
# 设置时区并创建工作目录
sudo timedatectl set-timezone "${TZ}"
sudo mkdir -p /mnt/workdir
sudo chown $USER:$GROUPS /mnt/workdir
df -Th
- name: Download source code
working-directory: /mnt/workdir
run: |
df -hT ${PWD}
git clone -q --single-branch --depth=1 --branch=${{ github.event.inputs.Version }} https://github.com/armbian/build.git build
ln -sf /mnt/workdir/build $GITHUB_WORKSPACE/build
cd build/
# 复制 config 和 userpatches 目录文件
cp -rf ${{ github.workspace }}/addboard/config/* config
mkdir -p userpatches
cp -rf ${{ github.workspace }}/addboard/userpatches/* userpatches
ls -la
- name: Compile Armbian [ ${{ inputs.BOARD }} ${{ inputs.RELEASE }} ]
run: |
# 进入编译目录
cd build/
# 定义支持的板子列表
declare -a SUPPORTED_BOARDS=("fine3399" "fmx1-pro" "r08" "rock960" "sg2710" "tpm312" "tb-ls3399" "xiaobao-nas" "zysj")
# 编译函数
compile_board() {
local BOARD=$1
echo "Compiling for board: $BOARD"
./compile.sh BOARD=$BOARD RELEASE=${{ inputs.RELEASE }} BRANCH=${{ inputs.BRANCH }} \
BUILD_MINIMAL=no BUILD_DESKTOP=${{ inputs.BUILD_DESKTOP }} KERNEL_CONFIGURE=no \
COMPRESS_OUTPUTIMAGE=${{ inputs.COMPRESS_OUTPUTIMAGE }} BOOT_LOGO=${{ inputs.BOOT_LOGO }} \
> "log-${BOARD}.txt" 2>&1
if [ $? -ne 0 ]; then
echo "Compilation failed for board: $BOARD" >&2
return 1
fi
return 0
}
# 多板编译模式
compile_all_boards() {
FAILED_BOARDS=()
for BOARD in "${SUPPORTED_BOARDS[@]}"; do
if ! compile_board "$BOARD"; then
FAILED_BOARDS+=("$BOARD")
fi
done
# 输出失败的板子列表
if [ ${#FAILED_BOARDS[@]} -gt 0 ]; then
echo "The following boards failed to compile: ${FAILED_BOARDS[*]}" >&2
else
echo "All boards compiled successfully."
fi
}
# 单板编译模式
compile_single_board() {
local BOARD=${{ inputs.BOARD }}
if [[ " ${SUPPORTED_BOARDS[@]} " =~ " $BOARD " ]]; then
if ! compile_board "$BOARD"; then
echo "Compilation failed for specified board: $BOARD" >&2
exit 1
fi
else
echo "Unsupported board: $BOARD" >&2
exit 1
fi
}
# 判断编译模式
if [ "${{ inputs.BOARD }}" = "all" ]; then
compile_all_boards
else
compile_single_board
fi
- name: Set current year and month
run: |
echo "CURRENT_YEAR_MONTH=$(date +'%Y%m')" >> $GITHUB_ENV
- name: Prepare Release Metadata
run: |
# 提取版本号
# latest_image=$(ls ${{ github.workspace }}/build/output/images/Armbian-unofficial_*.img.xz | grep -oE 'Armbian-unofficial_[0-9.]+_.*' | sort -V | tail -n 1)
latest_image=$(ls ${{ github.workspace }}/build/output/images/Armbian-unofficial_*.img.xz | sort -V | tail -n 1)
version=$(echo "$latest_image" | cut -d'_' -f2)
# 将版本号设置为环境变量
echo "VERSION=$version" >> $GITHUB_ENV
- name: Upload image to Release
if: success()
uses: ncipollo/release-action@main
with:
tag: "Armbian_${{ github.event.inputs.Version }}_${{ github.event.inputs.RELEASE }}_${{ env.CURRENT_YEAR_MONTH }}"
name: "Armbian_${{ github.event.inputs.Version }}_${{ github.event.inputs.RELEASE }}_${{ env.CURRENT_YEAR_MONTH }}"
artifacts: "${{ github.workspace }}/build/output/images/*"
allowUpdates: true
removeArtifacts: false
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
body: |
### Armbian Image Information
- Release: ${{ github.event.inputs.RELEASE }}
- Version: ${{ env.VERSION }}
### Armbian Image Verification
- sha256sum
draft: false
prerelease: false