Skip to content

Build armbian

Build armbian #19

Workflow file for this run

#==========================================================================
# Description: Build Armbian
# Copyright (C) 2021 https://github.com/ophub/amlogic-s9xxx-armbian
#==========================================================================
name: Build armbian
on:
repository_dispatch:
workflow_dispatch:
inputs:
set_release:
description: "Select OS Release."
required: false
default: "bookworm"
type: choice
options:
- jammy
- noble
- bookworm
- bullseye
armbian_board:
description: "Select device board."
required: false
default: "s922x-ct2000"
type: choice
options:
- a311d
- s922x-ct2000
- s922x-gtking
- s922x-gtkingpro-h
- s922x-odroid-n2
- s922x-reva
- s922x-ugoos-am6
armbian_kernel:
description: "Select kernel version."
required: false
default: "5.15.183"
type: choice
options:
- 5.4.y
- 5.10.y
- 5.15.183
- 6.1.y
- 6.6.y
- 6.12.y
- 5.4.y_5.10.y
- 5.15.y_6.1.y
- 6.1.y_6.12.y
- 6.1.y_6.6.y
- 6.6.y_6.12.y
auto_kernel:
description: "Auto use the latest kernel."
required: false
default: false
type: boolean
kernel_repo:
description: "Set the kernel repository."
required: false
default: "ophub/kernel"
type: choice
options:
- ophub/kernel
- andyfanybo/armbian-wxy
kernel_usage:
description: "Set the tags of the stable kernel."
required: false
default: "stable"
type: choice
options:
- stable
- flippy
- dev
- beta
armbian_fstype:
description: "Select armbian rootfs type."
required: false
default: "ext4"
type: choice
options:
- ext4
- btrfs
armbian_storage:
description: "Select image storage type."
required: false
default: "save"
type: choice
options:
- save
- temp
builder_name:
description: "Set Armbian builder signature."
required: false
default: "ophub"
type: choice
options:
- ophub
- angel
- andyfanybo
env:
TZ: America/New_York
ROOTFS_SCRIPT: compile-kernel/tools/script/armbian_rootfs.sh
jobs:
build:
runs-on: ubuntu-22.04
if: ${{ github.event.repository.owner.id }} == ${{ github.event.sender.id }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Initialization environment
id: init
env:
DEBIAN_FRONTEND: noninteractive
run: |
docker rmi $(docker images -q) 2>/dev/null
[[ -n "${AGENT_TOOLSDIRECTORY}" ]] && sudo rm -rf "${AGENT_TOOLSDIRECTORY}"
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d /usr/local/lib/android 2>/dev/null
sudo swapoff -a
sudo rm -f /swapfile /mnt/swapfile
sudo -E apt-get -y update
sudo -E apt-get -y purge azure-cli ghc* zulu* llvm* firefox google* dotnet* powershell openjdk* mongodb* moby* || true
sudo -E apt-get -y install $(curl -fsSL https://tinyurl.com/ubuntu2204-build-armbian)
sudo -E systemctl daemon-reload
#sudo -E apt-get -y full-upgrade
sudo -E apt-get -y autoremove --purge
sudo -E apt-get clean
sudo sed -i '/NVM_DIR/d;/skel/d' /root/{.bashrc,.profile}
sudo rm -rf ~/{.cargo,.dotnet,.rustup}
sudo timedatectl set-timezone "${TZ}"
echo "status=success" >> ${GITHUB_OUTPUT}
- name: Create simulated physical disk
run: |
mnt_size=$(expr $(df -h /mnt | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 1)
root_size=$(expr $(df -h / | tail -1 | awk '{print $4}' | sed 's/[[:alpha:]]//g' | sed 's/\..*//') - 4)
sudo truncate -s "${mnt_size}"G /mnt/mnt.img
sudo truncate -s "${root_size}"G /root.img
sudo losetup /dev/loop6 /mnt/mnt.img
sudo losetup /dev/loop7 /root.img
sudo pvcreate /dev/loop6
sudo pvcreate /dev/loop7
sudo vgcreate github /dev/loop6 /dev/loop7
sudo lvcreate -n runner -l 100%FREE github
sudo mkfs.xfs /dev/github/runner
sudo mkdir -p /builder
sudo mount /dev/github/runner /builder
sudo chown -R runner.runner /builder
df -Th
- name: Download source code
id: down
working-directory: /builder
if: ${{ steps.init.outputs.status }} == 'success' && !cancelled()
run: |
df -hT ${PWD}
git clone -q --single-branch --depth=1 --branch=main https://github.com/andyfanybo/armbian-build.git build
ln -sf /builder/build ${GITHUB_WORKSPACE}/build
ln -sf /builder/build /home/runner/work/_actions/andyfanybo/armbian-wxy/main/build
echo "status=success" >> ${GITHUB_OUTPUT}
- name: Compile Armbian [ ${{ inputs.set_release }} ]
id: compile
working-directory: /builder
if: ${{ steps.down.outputs.status }} == 'success' && !cancelled()
run: |
# Compile method and parameter description: https://docs.armbian.com/Developer-Guide_Build-Options
cd build/
./compile.sh RELEASE=${{ inputs.set_release }} BOARD=odroidn2 BRANCH=current BUILD_MINIMAL=no \
BUILD_ONLY=default HOST=armbian BUILD_DESKTOP=no EXPERT=yes KERNEL_CONFIGURE=no \
COMPRESS_OUTPUTIMAGE="sha" SHARE_LOG=yes
echo "status=success" >> ${GITHUB_OUTPUT}
- name: Organize files and clear space
id: clean
if: ${{ steps.compile.outputs.status }} == 'success' && !cancelled()
run: |
# Organize and keep essential files, delete unnecessary files
chmod +x ${ROOTFS_SCRIPT}
${ROOTFS_SCRIPT} -v ${{ inputs.set_release }}
# Output cleaning result information
df -hT ${PWD}
echo "build_tag=Armbian_${{ inputs.set_release }}_${{ inputs.armbian_storage }}_$(date +"%Y.%m")" >> ${GITHUB_OUTPUT}
echo "status=success" >> ${GITHUB_OUTPUT}
- name: Upload Armbian image to Release
uses: ncipollo/release-action@main
if: ${{ steps.clean.outputs.status }} == 'success' && !cancelled()
with:
tag: ${{ steps.clean.outputs.build_tag }}
artifacts: build/output/images/*
allowUpdates: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Rebuild Armbian
uses: andyfanybo/armbian-wxy@main
if: ${{ steps.clean.outputs.status }} == 'success' && !cancelled()
with:
build_target: armbian
armbian_path: build/output/images/*.img.gz
armbian_board: ${{ inputs.armbian_board }}
armbian_kernel: ${{ inputs.armbian_kernel }}
auto_kernel: ${{ inputs.auto_kernel }}
kernel_repo: ${{ inputs.kernel_repo }}
kernel_usage: ${{ inputs.kernel_usage }}
armbian_fstype: ${{ inputs.armbian_fstype }}
builder_name: ${{ inputs.builder_name }}
- name: Upload Rebuild image to Release
uses: ncipollo/release-action@main
if: ${{ env.PACKAGED_STATUS }} == 'success' && !cancelled()
with:
tag: ${{ steps.clean.outputs.build_tag }}
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/*
allowUpdates: true
removeArtifacts: false
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
body: |
### Armbian Image information
- Default username: root
- Default password: 1234
- Install command: armbian-install
- Update command: armbian-update
### Armbian Image Verification
- sha256sum