Skip to content

Build Armbian Customize Board #69

Build Armbian Customize Board

Build Armbian Customize Board #69

name: Build Armbian Customize Board
on:
workflow_dispatch:
inputs:
BOARD:
description: 'Board type'
required: true
default: 'tpm312'
type: choice
options:
- fine3399
- fmx1-pro
- r08
- rock960
- sg2710
- tpm312
- tb-ls3399
- xiaobao-nas
- zysj
BRANCH:
description: 'Armbian branch'
default: 'current'
required: false
type: choice
options:
- stable
- current
- edge
RELEASE:
description: 'Release name'
default: 'bookworm'
required: true
type: choice
options:
- jammy
- bookworm
- noble
- bullseye
Version:
description: 'Armbian Version'
default: 'v24.11'
required: false
type: choice
options:
- main
- 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-latest
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
# 设置时区并创建工作目录
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 /mnt/workdir/build/
./compile.sh BOARD=${{ inputs.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 }}
- 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