forked from ophub/amlogic-s9xxx-armbian
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (125 loc) · 5.59 KB
/
build-armbian.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#==========================================================================
# Description: Build Armbian
# Copyright (C) 2021 https://github.com/ophub/amlogic-s9xxx-armbian
#==========================================================================
name: Build armbian
on: [push]
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://is.gd/depend_ubuntu2204_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/armbian/build.git build
ln -sf /builder/build ${GITHUB_WORKSPACE}/build
ln -sf /builder/build /home/runner/work/_actions/ophub/amlogic-s9xxx-armbian/main/build
echo "status=success" >> ${GITHUB_OUTPUT}
- name: Compile Armbian [ bookworm ]
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=bookworm 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 bookworm
# Output cleaning result information
df -hT ${PWD}
echo "build_tag=Armbian_bookworm_save_$(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: ophub/amlogic-s9xxx-armbian@main
if: ${{ steps.clean.outputs.status }} == 'success' && !cancelled()
with:
build_target: armbian
armbian_path: build/output/images/*.img.gz
armbian_board: s905d
armbian_kernel: 6.6.y
auto_kernel: true
kernel_repo: orannnnnnge/amlogic-s9xxx-armbian
kernel_usage: stable
armbian_fstype: ext4
builder_name: orannnnnnge
- 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