Skip to content

Commit

Permalink
Add default Armbian Github compile action (armbian#6105)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik authored Dec 31, 2023
1 parent 52523d1 commit 53ff854
Show file tree
Hide file tree
Showing 2 changed files with 238 additions and 20 deletions.
46 changes: 26 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,16 @@

## Getting started

### Requirements
### Requirements for self hosted

- x86_64 / aarch64 machine
- at least 2GB of memory and ~35GB of disk space for VM, container or bare metal installation
- Ubuntu Jammy 22.04.x for native building or any Docker capable Linux for containerised
- [Armbian / Ubuntu Jammy 22.04.x](https://github.com/armbian/sdk) for native building or any Docker capable Linux for containerised
- Windows 10/11 with WSL2 subsystem running Ubuntu Jammy 22.04.x
- Superuser rights (configured sudo or root access).
- Make sure your system is up-to-date! Outdated Docker binaries, for example, can cause trouble.

### Start with the build script

##### Development branch:
For stable branch use `--branch=v23.11`

```bash
apt-get -y install git
Expand All @@ -37,16 +35,6 @@ cd build
./compile.sh
```

##### Stable branch:

```bash
apt-get -y install git
git clone --depth=1 --branch=v23.11 https://github.com/armbian/build
cd build
./compile.sh
```


<a href="#how-to-build-an-image-or-a-kernel"><img src=".github/README.gif" alt="Armbian logo" width="100%"></a>

- Interactive graphical interface.
Expand All @@ -61,20 +49,38 @@ Show work-in-progress areas in interactive mode:
./compile.sh EXPERT="yes"
```

Build minimal CLI Armbian Jammy for Raspberry Pi 4B with LTS kernel and write image directly to the SD card:
Build minimal CLI Armbian Jammy for Bananapi M5 with LTS kernel:

```bash
./compile.sh \
BOARD=rpi4b \
BOARD=bananapim5 \
BRANCH=current \
RELEASE=jammy \
BUILD_MINIMAL=yes \
BUILD_DESKTOP=no \
KERNEL_CONFIGURE=no \
CARD_DEVICE="/dev/sdX"
KERNEL_CONFIGURE=no
```

Build with GitHub actions: ([advanced version](https://github.com/armbian/os/blob/main/.github/workflows/complete-artifact-one-by-one.yml))

```
name: "Build Armbian"
on:
workflow_dispatch:
jobs:
build-armbian:
runs-on: ubuntu-latest
steps:
- uses: armbian/build@main
with:
armbian_token: "${{ secrets.GITHUB_TOKEN }}" # GitHub token
armbian_release: "jammy" # userspace
armbian_target: "build" # build=image, kernel=kernel
armbian_board: "bananapim5" # build target
```
Generated image will be uploaded to your repository release. Note: GitHub upload file limit is 2Gb.

More information:
## More information:

- [Building Armbian](https://docs.armbian.com/Developer-Guide_Build-Preparation/) (how to start, how to automate)
- [Build options](https://docs.armbian.com/Developer-Guide_Build-Options/) (all build options)
Expand Down
212 changes: 212 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
name: "Rebuild Armbian"
author: "https://github.com/armbian"
description: "Build Armbian Linux"
inputs:

armbian_token:
description: "GitHub installation access token"
required: true

armbian_runner_clean:
description: "Make some space on GH runners"
required: false
default: ""

armbian_artifacts:
descriptions: "Upload PATH"
required: false
default: "build/output/images/"

armbian_target:
description: "Build image or kernel"
required: false
default: "kernel"

armbian_branch:
description: "Choose framework branch"
required: false
default: "main"

armbian_kernel_branch:
description: "Choose kernel branch"
required: false
default: "current"

armbian_release:
description: "Choose userspace release"
required: false
default: "jammy"

armbian_version:
description: "Set different version"
required: false
default: ""

armbian_board:
description: "Select hardware platform"
required: false
default: "uefi-x86"

armbian_ui:
description: "Armbian user interface"
required: false
default: "server"

armbian_compress:
description: "Armbian compress method"
required: false
default: "sha,img,xz"

armbian_extensions:
description: "Armbian lists of extensions"
required: false
default: ""

armbian_userpatches:
description: "Armbian userpatches path"
required: false
default: ""

armbian_pgp_key:
description: "Armbian PGP key"
required: false
default: ""

armbian_pgp_password:
description: "Armbian PGP password"
required: false
default: ""

armbian_release_tittle:
description: "Armbian image"
required: false
default: "Armbian image"

armbian_release_body:
description: "Armbian images"
required: false
default: "Build with [Armbian tools](https://github.com/armbian/build)"

runs:
using: "composite"

steps:

- name: Free Github Runner
if: ${{ inputs.armbian_runner_clean != '' }}
uses: descriptinc/free-disk-space@main
with:
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: "Import GPG key"
if: ${{ inputs.armbian_pgp_key != '' }}
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ inputs.armbian_pgp_key }}
passphrase: ${{ inputs.armbian_pgp_password }}

- 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

- name: "Checkout customisations"
uses: actions/checkout@v4
with:
fetch-depth: 0
clean: false
path: custom

- shell: bash
run: |
# read version from upstream Armbian OS
cat os/stable.json | jq '.version' | sed "s/\"//g" | sed 's/^/ARMBIAN_VERSION=/' >> $GITHUB_ENV
[[ "${{ inputs.armbian_version }}" != '' ]] && echo "ARMBIAN_VERSION=${{ inputs.armbian_version }}" >> $GITHUB_ENV
# copy os userpatches and custom
mkdir -pv build/userpatches
rsync -av os/userpatches/. build/userpatches/
#[[ -d custom/userpatches ]] &&
rsync -av custom/userpatches/. build/userpatches/
- shell: bash
run: |
# userspace decode
if [[ "${{ inputs.armbian_ui }}" == minimal ]]; then
BUILD_DESKTOP="no"
BUILD_MINIMAL="yes"
elif [[ "${{ inputs.armbian_ui }}" == server ]]; then
BUILD_DESKTOP="no"
BUILD_MINIMAL="no"
else
BUILD_DESKTOP="yes"
BUILD_MINIMAL="no"
DESKTOP_ENVIRONMENT="${{ inputs.armbian_ui }}"
DESKTOP_APPGROUPS_SELECTED=""
DESKTOP_ENVIRONMENT_CONFIG_NAME="config_base"
fi
# go to build folder and checkout
cd build
git checkout ${{ inputs.armbian_branch }}
# execute build command
./compile.sh "${{ inputs.armbian_target }}" \
REVISION="${{ env.ARMBIAN_VERSION }}" \
BOARD="${{ inputs.armbian_board }}" \
BRANCH="${{ inputs.armbian_kernel_branch }}" \
RELEASE="${{ inputs.armbian_release }}" \
KERNEL_CONFIGURE="no" \
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}" \
ENABLE_EXTENSIONS="${{ inputs.armbian_extensions }}" \
COMPRESS_OUTPUTIMAGE="${{ inputs.armbian_compress }}" \
SHARE_LOG="yes" \
EXPERT="yes"
- name: Sign
shell: bash
if: ${{ inputs.armbian_pgp_password != '' }}
run: |
echo ${{ inputs.armbian_pgp_password }} | \
gpg --passphrase-fd 0 --armor --detach-sign --pinentry-mode loopback --batch --yes \
build/output/images/*.img*.xz
- uses: ncipollo/release-action@v1
with:
tag: "${{ env.ARMBIAN_VERSION }}"
name: "${{ inputs.armbian_release_tittle }}"
artifacts: "${{ inputs.armbian_artifacts }}*"
allowUpdates: true
removeArtifacts: false
replacesArtifacts: true
makeLatest: true
token: "${{ inputs.armbian_token }}"
body: |
${{ inputs.armbian_release_body }}
branding:
icon: "check"
color: "red"

0 comments on commit 53ff854

Please sign in to comment.