Skip to content

Armbian

Armbian #311

Workflow file for this run

name: Armbian
on:
workflow_dispatch:
inputs:
asset:
description: 'Asset'
type: choice
options: [kernel, uboot, firmware]
default: kernel
required: true
branch:
description: 'Branch'
type: choice
options: [legacy, current, edge, vendor, collabora]
default: current
required: true
board:
description: 'Board'
required: true
gitowner:
description: 'Override Git owner of Armbian repo'
gitbranch:
description: 'Override Git branch of Armbian repo'
rebase:
description: 'Rebase onto latest armbian/main'
type: boolean
default: true
concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.asset }}-${{ github.event.inputs.branch }}-${{ github.event.inputs.board }}
cancel-in-progress: true
permissions: {}
jobs:
build:
name: "${{ github.event.inputs.asset }} - ${{ github.event.inputs.branch }} - ${{ github.event.inputs.board }}"
# https://github.com/actions/runner-images
runs-on: ubuntu-24.04
steps:
- name: Clone Armbian repo
run: |
owner='${{ github.event.inputs.gitowner }}'
[ "$owner" ] || owner='MichaIng'
branch='${{ github.event.inputs.gitbranch }}'
[ "$branch" ] || branch='dietpi'
git clone -b "$branch" "https://github.com/$owner/build"
[ '${{ github.event.inputs.rebase }}' == 'false' ] && exit 0 || :
cd build
git config user.name "$GITHUB_REPOSITORY_OWNER"
git config user.email '${{ github.repository.owner.email }}'
if [ "$owner" != 'MichaIng' ]
then
git remote add dietpi https://github.com/MichaIng/build
git fetch dietpi dietpi
git rebase dietpi/dietpi
elif [ "$branch" != 'dietpi' ]
then
git fetch origin dietpi
git rebase origin/dietpi
fi
if [ "$owner" != 'armbian' ]
then
git remote add upstream https://github.com/armbian/build
git fetch upstream main
git rebase upstream/main
elif [ "$branch" != 'main' ]
then
git fetch origin main
git rebase origin/main
fi
- name: Obtain version suffix
run: |
cd build
read -r version < VERSION
case '${{ github.event.inputs.asset }}' in
firmware) package='armbian-firmware';;
uboot) package='linux-u-boot-${{ github.event.inputs.board }}-${{ github.event.inputs.branch }}';;
kernel)
family=$(. 'config/boards/${{ github.event.inputs.board }}.'* &> /dev/null; echo "$BOARDFAMILY")
echo "Board family is: $family"
family=$(BRANCH='${{ github.event.inputs.branch }}'; . "config/sources/families/$family.conf" &> /dev/null; echo "$LINUXFAMILY")
echo "Linux family is: $family"
package="linux-dtb-${{ github.event.inputs.branch }}-$family"
;;
*) echo 'ERROR: Invalid asset "${{ github.event.inputs.asset }}"'; exit 1;;
esac
if curl -fO "https://dietpi.com/downloads/binaries/$package.deb"
then
cur_version=$(dpkg-deb -f "$package.deb" Version)
rm "$package.deb"
cur_suffix=${cur_version#*-dietpi}
echo "Current package version is: $cur_version"
fi
echo "New Armbian version is: $version"
[ "$version-dietpi$cur_suffix" = "$cur_version" ] && version="$version-dietpi$((cur_suffix+1))" || version="$version-dietpi1"
echo "New package version will be: $version"
echo "$version" > VERSION
- name: Build asset
run: |
cd build
./compile.sh '${{ github.event.inputs.asset }}' BRANCH='${{ github.event.inputs.branch }}' BOARD='${{ github.event.inputs.board }}'
- name: Upload
run: |
# SSH server and client keys
mkdir ~/.ssh
umask 377
echo '${{ secrets.KNOWN_HOSTS }}' > ~/.ssh/known_hosts
echo '${{ secrets.SSH_KEY }}' > ~/.ssh/id_ed25519
# Generate file lists
files=
urls='"https://dietpi.com/downloads/binaries/testing/"'
cd build/output/debs
for i in *
do
mv -v "$i" "${i%%_*}.deb"
i="${i%%_*}.deb"
files="$files,$i"
urls="$urls,\"https://dietpi.com/downloads/binaries/testing/$i\""
done
files=${files#,}
echo "Uploading file(s) $files to URL(s) $urls ..."
# Upload
curl -T "{$files}" --key ~/.ssh/id_ed25519 '${{ secrets.UPLOAD_URL }}all/'
curl 'https://api.cloudflare.com/client/v4/zones/${{ secrets.CF_ZONE }}/purge_cache' -H 'Authorization: Bearer ${{ secrets.CF_TOKEN }}' -H 'Content-Type: application/json' --data "{\"files\":[$urls]}"