Skip to content

Commit e0434ce

Browse files
committed
Add automated Armbian build workflow
- Add GitHub Actions workflow for automated Armbian image builds - Daily cron to check upstream armbian/build VERSION - Builds when version changes, uploads to GitHub Releases - Updates images.json with new metadata - Add images.json for tracking latest image info - Update docs with latest pre-built image section - Add --latest flag to download script for easy access
1 parent a03bfde commit e0434ce

File tree

4 files changed

+419
-7
lines changed

4 files changed

+419
-7
lines changed
Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
name: Build Armbian Image
2+
3+
on:
4+
schedule:
5+
# Run daily at 03:00 UTC
6+
- cron: '0 3 * * *'
7+
workflow_dispatch:
8+
inputs:
9+
force_build:
10+
description: 'Force build regardless of version change'
11+
type: boolean
12+
default: false
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
check-version:
19+
name: Check Upstream Version
20+
runs-on: ubuntu-latest
21+
outputs:
22+
build_needed: ${{ steps.check.outputs.build_needed }}
23+
upstream_version: ${{ steps.check.outputs.upstream_version }}
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Check upstream VERSION
29+
id: check
30+
run: |
31+
# Fetch current upstream VERSION from armbian/build
32+
UPSTREAM_VERSION=$(curl -sL https://raw.githubusercontent.com/armbian/build/main/VERSION | tr -d '\n\r')
33+
echo "upstream_version=$UPSTREAM_VERSION" >> $GITHUB_OUTPUT
34+
echo "Upstream Armbian version: $UPSTREAM_VERSION"
35+
36+
# Get last built version from images.json
37+
LAST_BUILT=""
38+
if [ -f images.json ]; then
39+
LAST_BUILT=$(jq -r '.latest.armbian_version // ""' images.json)
40+
fi
41+
echo "Last built version: $LAST_BUILT"
42+
43+
# Determine if build is needed
44+
if [ "$UPSTREAM_VERSION" != "$LAST_BUILT" ] || [ "${{ inputs.force_build }}" == "true" ]; then
45+
echo "build_needed=true" >> $GITHUB_OUTPUT
46+
echo "Build needed: version changed or force build requested"
47+
else
48+
echo "build_needed=false" >> $GITHUB_OUTPUT
49+
echo "Build not needed: version unchanged"
50+
fi
51+
52+
build:
53+
name: Build Armbian
54+
needs: check-version
55+
if: needs.check-version.outputs.build_needed == 'true'
56+
runs-on: ubuntu-latest
57+
timeout-minutes: 180
58+
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v4
62+
63+
- name: Maximize build space
64+
uses: easimon/maximize-build-space@master
65+
with:
66+
root-reserve-mb: 4096
67+
swap-size-mb: 1024
68+
remove-dotnet: 'true'
69+
remove-android: 'true'
70+
remove-haskell: 'true'
71+
remove-codeql: 'true'
72+
73+
- name: Install dependencies
74+
run: |
75+
sudo apt-get update
76+
sudo apt-get install -y jq
77+
78+
- name: Clone Armbian build framework
79+
run: |
80+
git clone --depth=1 https://github.com/armbian/build armbian-build
81+
82+
- name: Build Armbian image
83+
run: |
84+
cd armbian-build
85+
./compile.sh build \
86+
BOARD=turing-rk1 \
87+
BRANCH=vendor \
88+
RELEASE=bookworm \
89+
BUILD_MINIMAL=no \
90+
BUILD_DESKTOP=no \
91+
KERNEL_CONFIGURE=no \
92+
COMPRESS_OUTPUTIMAGE=xz,sha
93+
94+
- name: Extract image metadata
95+
id: metadata
96+
run: |
97+
# Find the built image
98+
IMAGE_FILE=$(ls armbian-build/output/images/*.img.xz 2>/dev/null | head -1)
99+
if [ -z "$IMAGE_FILE" ]; then
100+
echo "Error: No image file found"
101+
exit 1
102+
fi
103+
104+
FILENAME=$(basename "$IMAGE_FILE")
105+
SIZE=$(stat -c%s "$IMAGE_FILE")
106+
SIZE_HUMAN=$(numfmt --to=iec-i --suffix=B "$SIZE")
107+
SHA256=$(sha256sum "$IMAGE_FILE" | cut -d' ' -f1)
108+
109+
# Extract kernel version from filename
110+
KERNEL=$(echo "$FILENAME" | grep -oP '\d+\.\d+\.\d+' | tail -1)
111+
112+
echo "filename=$FILENAME" >> $GITHUB_OUTPUT
113+
echo "size=$SIZE" >> $GITHUB_OUTPUT
114+
echo "size_human=$SIZE_HUMAN" >> $GITHUB_OUTPUT
115+
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
116+
echo "kernel=$KERNEL" >> $GITHUB_OUTPUT
117+
118+
echo "Image: $FILENAME"
119+
echo "Size: $SIZE_HUMAN"
120+
echo "SHA256: $SHA256"
121+
echo "Kernel: $KERNEL"
122+
123+
- name: Create GitHub Release
124+
id: release
125+
uses: softprops/action-gh-release@v2
126+
with:
127+
tag_name: armbian-${{ needs.check-version.outputs.upstream_version }}
128+
name: Armbian ${{ needs.check-version.outputs.upstream_version }} for Turing RK1
129+
body: |
130+
## Armbian Image for Turing RK1
131+
132+
| Property | Value |
133+
|----------|-------|
134+
| Version | ${{ needs.check-version.outputs.upstream_version }} |
135+
| Kernel | ${{ steps.metadata.outputs.kernel }} (vendor branch) |
136+
| Release | Bookworm (Debian 12) |
137+
| Size | ${{ steps.metadata.outputs.size_human }} |
138+
| SHA256 | `${{ steps.metadata.outputs.sha256 }}` |
139+
140+
### Features
141+
- Rockchip vendor kernel with NPU support
142+
- Pre-configured for Turing Pi cluster deployment
143+
144+
### Download & Flash
145+
146+
```bash
147+
# Download
148+
wget https://github.com/${{ github.repository }}/releases/download/armbian-${{ needs.check-version.outputs.upstream_version }}/${{ steps.metadata.outputs.filename }}
149+
150+
# Verify checksum
151+
echo "${{ steps.metadata.outputs.sha256 }} ${{ steps.metadata.outputs.filename }}" | sha256sum -c
152+
153+
# Decompress
154+
xz -d ${{ steps.metadata.outputs.filename }}
155+
156+
# Prepare for node (optional - injects SSH keys, static IP)
157+
./scripts/prepare-armbian-image.sh ${IMAGE%.xz} 1
158+
159+
# Flash to node
160+
tpi flash --node 1 --image-path ${IMAGE%.xz}
161+
```
162+
163+
### Using the download script
164+
165+
```bash
166+
./scripts/download-armbian-image.sh --latest
167+
```
168+
files: |
169+
armbian-build/output/images/*.img.xz
170+
armbian-build/output/images/*.img.sha
171+
armbian-build/output/images/*.img.txt
172+
173+
- name: Update images.json
174+
run: |
175+
VERSION="${{ needs.check-version.outputs.upstream_version }}"
176+
DATE=$(date -u +%Y-%m-%d)
177+
RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/armbian-${VERSION}"
178+
DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/armbian-${VERSION}/${{ steps.metadata.outputs.filename }}"
179+
CHECKSUM_URL="https://github.com/${{ github.repository }}/releases/download/armbian-${VERSION}/${{ steps.metadata.outputs.filename }}.sha256"
180+
181+
# Initialize images.json if it doesn't exist
182+
if [ ! -f images.json ]; then
183+
echo '{"history":[],"build_config":{"board":"turing-rk1","branch":"vendor","release":"bookworm"}}' > images.json
184+
fi
185+
186+
# Update images.json with new metadata
187+
jq --arg version "$VERSION" \
188+
--arg kernel "${{ steps.metadata.outputs.kernel }}" \
189+
--arg date "$DATE" \
190+
--arg filename "${{ steps.metadata.outputs.filename }}" \
191+
--arg size "${{ steps.metadata.outputs.size }}" \
192+
--arg sha256 "${{ steps.metadata.outputs.sha256 }}" \
193+
--arg download_url "$DOWNLOAD_URL" \
194+
--arg checksum_url "$CHECKSUM_URL" \
195+
--arg release_url "$RELEASE_URL" \
196+
'.latest = {
197+
armbian_version: $version,
198+
kernel_version: $kernel,
199+
release: "bookworm",
200+
branch: "vendor",
201+
build_date: $date,
202+
filename: $filename,
203+
size_bytes: ($size | tonumber),
204+
sha256: $sha256,
205+
download_url: $download_url,
206+
checksum_url: $checksum_url,
207+
release_url: $release_url
208+
} | .history = ([{
209+
armbian_version: $version,
210+
build_date: $date,
211+
release_url: $release_url
212+
}] + .history[0:9])' images.json > images.json.tmp && mv images.json.tmp images.json
213+
214+
echo "Updated images.json:"
215+
cat images.json
216+
217+
- name: Commit and push changes
218+
run: |
219+
git config user.name "github-actions[bot]"
220+
git config user.email "github-actions[bot]@users.noreply.github.com"
221+
git add images.json
222+
git diff --cached --quiet || git commit -m "Update Armbian image metadata for version ${{ needs.check-version.outputs.upstream_version }}"
223+
git push

docs/ARMBIAN-BUILD.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,47 @@ This guide covers building a custom Armbian image for Turing RK1 compute modules
99
- **Reproducibility**: Consistent builds for all cluster nodes
1010
- **Latest Updates**: Get newer packages than pre-built images
1111

12+
## Latest Pre-built Image
13+
14+
Pre-built images are automatically generated when new Armbian versions are released.
15+
16+
| Property | Value |
17+
|----------|-------|
18+
| Version | 26.02.0-trunk |
19+
| Kernel | 6.1.115 (vendor branch, NPU support) |
20+
| Release | Bookworm (Debian 12) |
21+
| Size | ~491 MB (compressed) |
22+
23+
### Quick Download
24+
25+
```bash
26+
# Using the download script
27+
./scripts/download-armbian-image.sh --latest
28+
29+
# Or download directly
30+
wget $(jq -r '.latest.download_url' images.json)
31+
```
32+
33+
### Verify & Flash
34+
35+
```bash
36+
# Verify checksum
37+
echo "$(jq -r '.latest.sha256' images.json) $(jq -r '.latest.filename' images.json)" | sha256sum -c
38+
39+
# Decompress
40+
xz -d Armbian-*.img.xz
41+
42+
# Prepare for specific node (injects SSH key, static IP)
43+
./scripts/prepare-armbian-image.sh Armbian-*.img 1
44+
45+
# Flash to node
46+
tpi flash --node 1 --image-path Armbian-*.img
47+
```
48+
49+
See [images.json](../images.json) for full metadata including download URLs and checksums.
50+
51+
> **Note**: The automated build workflow checks daily for new Armbian versions and publishes updated images to [GitHub Releases](https://github.com/jfreed-dev/turing-ansible-cluster/releases).
52+
1253
## Prerequisites
1354

1455
### System Requirements

images.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"latest": {
3+
"armbian_version": "26.02.0-trunk",
4+
"kernel_version": "6.1.115",
5+
"release": "bookworm",
6+
"branch": "vendor",
7+
"build_date": "2025-12-24",
8+
"filename": "Armbian-unofficial_26.02.0-trunk_Turing-rk1_bookworm_vendor_6.1.115.img.xz",
9+
"size_bytes": 514725992,
10+
"sha256": "a4f42c5c88bea566e2663e039cec43b4e1a46c5112118f5bcee746c1f16a58c1",
11+
"download_url": "https://drive.google.com/open?id=16wa6dNsBJSYoPg9lZnpThxMcdxHxbwf9",
12+
"checksum_url": null,
13+
"release_url": null
14+
},
15+
"history": [
16+
{
17+
"armbian_version": "26.02.0-trunk",
18+
"build_date": "2025-12-24",
19+
"release_url": null
20+
}
21+
],
22+
"build_config": {
23+
"board": "turing-rk1",
24+
"branch": "vendor",
25+
"release": "bookworm",
26+
"build_minimal": false,
27+
"build_desktop": false
28+
}
29+
}

0 commit comments

Comments
 (0)