Building main Custom Armbian Images #112 #112
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Build Custom Armbian Images" | |
run-name: "Building ${{ github.ref_name }} Custom Armbian Images #${{ github.run_number }}" | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
debian_releases: | |
description: comma separated list of debian releases to build | |
default: bookworm,trixie | |
required: false | |
type: string | |
kernel_versions: | |
description: Comma separated list of Kernel versions to use (vendor, current, legacy) | |
default: vendor,legacy | |
required: false | |
type: string | |
image_type: | |
description: Type of image to build (minimal,server,xfce,etc) | |
default: minimal,server,xfce | |
required: false | |
type: string | |
release: | |
description: Make a release? | |
required: false | |
default: true | |
type: boolean | |
board: | |
description: Board to build for | |
required: false | |
default: radxa-zero3 | |
type: string | |
armbian_version: | |
description: Armbian Version | |
default: 24.5.0-trunk.434 | |
required: false | |
type: string | |
build_dietpi: | |
description: Build DietPi? | |
required: false | |
default: true | |
type: boolean | |
dietpi-owner: | |
description: DietPi Repo Owner | |
default: MichaIng | |
required: false | |
dietpi-branch: | |
description: DietPi Repo Branch | |
default: imager | |
type: string | |
required: false | |
# Ensure there is only one instance of job running | |
concurrency: | |
# group: ${{ github.run_id }}-custom | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: false | |
# Allow writing packages | |
permissions: | |
contents: read | |
packages: write | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
continue-on-error: false | |
steps: | |
- name: Create Matrix | |
id: matrix | |
run: | | |
echo "kernels=$(jq 'split(",")' -Rc <(echo '${{ inputs.kernel_versions || 'vendor' }}'))" >> $GITHUB_OUTPUT | |
echo "image_type=$(jq 'split(",")' -Rc <(echo '${{ inputs.image_type || 'minimal' }}'))" >> $GITHUB_OUTPUT | |
echo "releases=$(jq 'split(",")' -Rc <(echo '${{ inputs.debian_releases || 'bookworm' }}'))" >> $GITHUB_OUTPUT | |
- name: Check Matrix | |
id: check | |
run: | | |
echo "${{ steps.matrix.outputs.releases }}" | |
echo "${{ steps.matrix.outputs.image_type }}" | |
echo "${{ steps.matrix.outputs.kernels }}" | |
- name: Get Inputs or Set Defaults | |
id: inputs | |
run: | | |
echo "Make a release? ${{ inputs.release || true }}" | |
echo "make_release=${{ inputs.release || true }}" >> $GITHUB_OUTPUT | |
echo "Armbian Version: ${{ inputs.armbian_version || '24.5.0-trunk.43' }}" | |
echo "armbian_version=${{ inputs.armbian_version || '24.5.0-trunk.43' }}" >> $GITHUB_OUTPUT | |
echo "Board: ${{ inputs.board || 'radxa-zero3' }}" | |
echo "board=${{ inputs.board || 'radxa-zero3' }}" >> $GITHUB_OUTPUT | |
echo "Build DietPi? ${{ inputs.build_dietpi || true }}" | |
echo "build_dietpi=${{ inputs.build_dietpi || true }}" >> $GITHUB_OUTPUT | |
echo "DietPi Owner: ${{ inputs.dietpi_owner || 'MichaIng' }}" | |
echo "dietpi_owner=${{ inputs.dietpi_owner || 'MichaIng' }}" >> $GITHUB_OUTPUT | |
echo "DietPi Branch: ${{ inputs.dietpi_branch || 'imager' }}" | |
echo "dietpi_branch=${{ inputs.dietpi_branch || 'imager' }}" >> $GITHUB_OUTPUT | |
echo "Building for Kernel(s): ${{ steps.matrix.outputs.kernels }}" | |
echo "Building Debian Release(s): ${{ steps.matrix.outputs.releases}}" | |
echo "Building Images(s): ${{ steps.matrix.outputs.image_type }}" | |
outputs: | |
make_release: ${{ steps.inputs.outputs.make_release }} | |
armbian_version: ${{ steps.inputs.outputs.armbian_version }} | |
board: ${{ steps.inputs.outputs.board }} | |
build_dietpi: ${{ steps.inputs.outputs.build_dietpi }} | |
dietpi_owner: ${{ steps.inputs.outputs.dietpi_owner }} | |
dietpi_branch: ${{ steps.inputs.outputs.dietpi_branch }} | |
releases: ${{ steps.matrix.outputs.releases }} | |
uis: ${{ steps.matrix.outputs.image_type }} | |
kernels: ${{ steps.matrix.outputs.kernels }} | |
build-armbian: | |
continue-on-error: true | |
# Create a matrix of all the types of images that we want to build. | |
strategy: | |
fail-fast: false | |
matrix: | |
release: ${{ fromJson(needs.setup.outputs.releases) }} | |
ui: ${{ fromJson(needs.setup.outputs.uis) }} | |
kernel: ${{ fromJson(needs.setup.outputs.kernels) }} | |
name: "${{ matrix.ui }} | ${{ matrix.release }}-${{ matrix.kernel }}" | |
env: | |
make_release: ${{ needs.setup.outputs.make_release }} | |
armbian_version: ${{ needs.setup.outputs.armbian_version }} | |
board: ${{ needs.setup.outputs.board }} | |
build_dietpi: ${{ needs.setup.outputs.build_dietpi }} | |
dietpi_owner: ${{ needs.setup.outputs.dietpi_owner }} | |
dietpi_branch: ${{ needs.setup.outputs.dietpi_branch }} | |
runs-on: ubuntu-latest | |
needs: ["setup"] | |
steps: | |
- name: "Checkout Armbian os" | |
uses: actions/checkout@v4 | |
with: | |
repository: armbian/os | |
fetch-depth: 0 | |
clean: false | |
path: os | |
- name: "Checkout Armbian build framework" | |
uses: actions/checkout@v4 | |
with: | |
repository: armbian/build | |
fetch-depth: 0 | |
clean: false | |
path: build | |
# Checkout armbian branch of this repo (keeping separated for easier identification of modifications). | |
- name: "Checkout Armbian branch customisations" | |
uses: actions/checkout@v4 | |
with: | |
ref: "armbian" | |
fetch-depth: 0 | |
clean: false | |
path: custom | |
- name: Armbian Customisations | |
shell: bash | |
id: customisation | |
run: | | |
# copy os userpatches (from armbian repo) and | |
# copy custom user patches (from armbian branch of this repo) | |
mkdir -pv build/userpatches | |
rsync -av os/userpatches/. build/userpatches/ | |
[[ -d custom/userpatches ]] && rsync -av custom/userpatches/. build/userpatches/ | |
- name: Compile Armbian ${{ matrix.release }}-${{ matrix.kernel }} | |
id: compile | |
shell: bash | |
run: | | |
# Get kind of ui | |
if [[ "${{ matrix.ui }}" == minimal ]]; then | |
BUILD_DESKTOP="no" | |
BUILD_MINIMAL="yes" | |
elif [[ "${{ matrix.ui }}" == server ]]; then | |
BUILD_DESKTOP="no" | |
BUILD_MINIMAL="no" | |
else | |
BUILD_DESKTOP="yes" | |
BUILD_MINIMAL="no" | |
DESKTOP_ENVIRONMENT="${{ matrix.ui }}" | |
DESKTOP_APPGROUPS_SELECTED="" | |
DESKTOP_ENVIRONMENT_CONFIG_NAME="config_base" | |
fi | |
# go to build folder and checkout | |
cd build | |
git checkout main | |
# execute build command | |
./compile.sh "build" \ | |
REVISION="${{ env.armbian_version }}" \ | |
BOARD="${{ env.board }}" \ | |
BRANCH="${{ matrix.kernel }}" \ | |
RELEASE="${{ matrix.release }}" \ | |
KERNEL_CONFIGURE="no" \ | |
COMPRESS_OUTPUTIMAGE="sha,xz" \ | |
BUILD_DESKTOP="${BUILD_DESKTOP}" \ | |
BUILD_MINIMAL="${BUILD_MINIMAL}" \ | |
DESKTOP_ENVIRONMENT="${DESKTOP_ENVIRONMENT}" \ | |
DESKTOP_APPGROUPS_SELECTED="${DESKTOP_APPGROUPS_SELECTED}" \ | |
DESKTOP_ENVIRONMENT_CONFIG_NAME="${DESKTOP_ENVIRONMENT_CONFIG_NAME}" \ | |
SHARE_LOG="yes" \ | |
BETA="yes" \ | |
EXPERT="yes" | |
# ENABLE_EXTENSIONS="${{ inputs.armbian_extensions }}" \ | |
- name: Get file names | |
run: | | |
ls -R build/output/images/ | |
# Upload Armbian images to artifacts (we'll download them and add them to the release later). | |
- name: Upload Armbian Artifacts for Release | |
id: armbian_artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "armbian-${{ env.board }}-${{ matrix.ui }}-${{ matrix.release }}-${{ matrix.kernel }}" | |
path: | | |
build/output/images/* | |
!build/output/images/*.img | |
- name: Decompress Image | |
if: ${{ env.build_dietpi == 'true' }} | |
run: | | |
sudo unxz -k build/output/images/*.xz | |
- name: List all outputs | |
if: ${{ env.build_dietpi == 'true' }} | |
run: | | |
ls -R build/output/images/ | |
- name: Build Diet PI | |
if: ${{ env.build_dietpi == 'true' }} | |
shell: bash | |
env: | |
G_GITOWNER: ${{ env.dietpi_owner }} | |
G_GITBRANCH: ${{ env.dietpi_branch }} | |
FP_ROOT_DEV: /dev/loop0p2 | |
CLONING_TOOL: dd | |
OUTPUT_IMG_NAME: DietPi_${{ env.board }}-${{matrix.ui}}-${{ matrix.release }}-${{ matrix.kernel }} | |
OUTPUT_IMG_EXT: img | |
ADD_DOS_PART: 1 | |
CONFIGS_TO_BOOT: 1 | |
run: | | |
sudo --preserve-env bash -c "$(curl -sSfL 'https://raw.githubusercontent.com/${{ env.dietpi_owner }}/DietPi/${{ env.dietpi_branch }}/.build/images/dietpi-imager')" -i build/output/images/*.img | |
# - name: List all outputs | |
# if: ${{ env.BUILD_DIETPI == 'true' }} | |
# run: | | |
# ls -R . | |
# Upload Armbian images to artifacts (we'll download them and add them to the release later). | |
- name: Upload DietPi Artifacts for Release | |
id: dietpi_artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "dietpi-${{ env.board }}-${{ matrix.ui }}-${{ matrix.release }}-${{ matrix.kernel }}" | |
path: | | |
./DietPi*.xz | |
./DietPi*.sha256 | |
outputs: | |
armbian-artifacts: ${{ steps.armbian_artifacts.outputs.artifact-id }} | |
dietpi-artifacts: ${{ steps.dietpi_artifacts.outputs.artifact-id }} | |
release: | |
runs-on: ubuntu-latest | |
needs: [build-armbian, setup] | |
env: | |
make_release: ${{ needs.setup.outputs.make_release }} | |
armbian_version: ${{ needs.setup.outputs.armbian_version }} | |
board: ${{ needs.setup.outputs.board }} | |
build_dietpi: ${{ needs.setup.outputs.build_dietpi }} | |
dietpi_owner: ${{ needs.setup.outputs.dietpi_owner }} | |
dietpi_branch: ${{ needs.setup.outputs.dietpi_branch }} | |
steps: | |
- name: Get current date | |
id: date | |
run: echo "DATE=$(date +'%y.%m.%d')" >> $GITHUB_ENV | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Display structure of downloaded files | |
run: ls -R | |
- uses: ncipollo/release-action@v1 | |
with: | |
tag: "${{ env.DATE }}" | |
name: "${{ env.DATE }} Radxa Images" | |
artifacts: "./*.txt,./*.xz,./*.sha,./*.sha256" | |
allowUpdates: true | |
removeArtifacts: false | |
replacesArtifacts: true | |
makeLatest: true | |
token: "${{ secrets.ARMBIAN_SELF_DISPATCH_TOKEN }}" | |
body: | | |
Radxa Custom Images: | |
based on Armbian v${{ env.armbian_version }} |