forked from helmiau/HelmiWrt-OS-Immortal
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (141 loc) · 6.63 KB
/
build-s905x-t95.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#=================================================
# https://github.com/P3TERX/Actions-OpenWrt
# Description: Repack HelmiWrt OS for s905x devices using GitHub Actions
# Lisence: MIT
# Repacker : Raditya Budi Handoko <https://github.com/radityabh>
# HelmiWrt OS by helmiau.com
#=================================================
name: Build Amlogic s905x-t95 21.02
on:
workflow_dispatch:
# schedule:
# - cron: 59 23 * * *
# watch:
# types: started
env:
REPO_URL: https://github.com/ophub/amlogic-s9xxx-openwrt.git
REPO_BRANCH: main
PROC_LISTS: s905x-t95
KERNEL_VR: 5.15.85_6.1.1
KERNEL_REPO: https://github.com/ophub/kernel/tree/main/pub
SOURCE_BRANCH: 21.02
UPLOAD_RELEASE: true
TZ: Asia/Jakarta
jobs:
Build:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@main
- name: Initialization Environment
env:
DEBIAN_FRONTEND: noninteractive
run: |
chmod +x $GITHUB_WORKSPACE/scripts/free_disk_space.sh && $GITHUB_WORKSPACE/scripts/free_disk_space.sh
docker rmi `docker images -q`
sudo rm -rf /usr/share/dotnet /etc/apt/sources.list.d /usr/local/lib/android 2>/dev/null
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_openwrt)
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 mkdir -p /workdir
sudo chown ${USER}:${GROUPS} /workdir
sudo timedatectl set-timezone "${TZ}"
export BUILD_DATE=$(curl -sL https://api.github.com/repos/helmiau/HelmiWrt-OS-Immortal/releases | jq -r '.[0] | .tag_name' | sed 's/helmiwrt-//g')
echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_ENV
git config --global credential.helper store
git clone https://$GITHUB_REPOSITORY_OWNER:${{ secrets.HELMIWRT_RW }}@github.com/$GITHUB_REPOSITORY_OWNER/HelmiWrt-Plus.git filex
export UP_USERNEW=$( grep new_user filex/up_info.txt | sed 's/new_user=//g' )
echo "UP_USERNEW=$UP_USERNEW" >> $GITHUB_ENV
export UP_NEW=$( grep new_repo filex/up_info.txt | sed 's/new_repo=//g' )
echo "UP_NEW=$UP_NEW" >> $GITHUB_ENV
rm -rf filex
export HELMIWRT_REL="https://github.com/$UP_USERNEW/$UP_NEW/releases/download/helmiwrt"
echo "HELMIWRT_REL=$HELMIWRT_REL" >> $GITHUB_ENV
export SOURCE_BRANCH=$SOURCE_BRANCH
echo "SOURCE_BRANCH=$SOURCE_BRANCH" >> $GITHUB_ENV
- name: Cloning Source
working-directory: /workdir
run: |
df -hT $PWD
git clone --depth 1 $REPO_URL -b $REPO_BRANCH openwrt
ln -sf /workdir/openwrt $GITHUB_WORKSPACE/openwrt
- name: Install Feeds
id: feeds
run: |
cd openwrt
echo "OPENWRTROOT=$PWD" >> $GITHUB_ENV
- name: Building HelmiWrt
id: build
run: |
cd $OPENWRTROOT
export HELMIWRT_FILENAME="helmiwrt-$SOURCE_BRANCH-armvirt-64-default-rootfs.tar.gz"
echo "HELMIWRT_FILENAME=$HELMIWRT_FILENAME" >> $GITHUB_ENV
# Set ROOTFS size from helmiwrt build config
export ROOTFS_SIZE="$(curl -v --silent https://raw.githubusercontent.com/helmiau/HelmiWrt-OS-Immortal/main/config/universal.config 2>&1 | grep 'CONFIG_TARGET_ROOTFS_PARTSIZE=' | sed 's|CONFIG_TARGET_ROOTFS_PARTSIZE=||g')"
echo "ROOTFS_SIZE=$ROOTFS_SIZE" >> $GITHUB_ENV
# Start Build s9xxx based on $SOURCE_BRANCH source.
if wget -q --method=HEAD "$HELMIWRT_REL-$BUILD_DATE/$HELMIWRT_FILENAME"; then
# Using modified make file, then modify output file name
[ -f make ] && rm -f make && wget -q https://raw.githubusercontent.com/helmiau/HelmiWrt-OS-Immortal/main/scripts/make-amlogic -O make
sed -i "/build_image_file=/c\ build_image_file=\"\${out_path}/helmiwrt-$SOURCE_BRANCH-\${board}-k\${kernel}.img\"" make
grep "build_image_file=" make
# Download Firmware $SOURCE_BRANCH
echo "$HELMIWRT_FILENAME rootfs found under $BUILD_DATE tag! Start downloading..."
[ -d openwrt-armvirt ] || mkdir -p openwrt-armvirt
wget -q -P openwrt-armvirt "$HELMIWRT_REL-$BUILD_DATE/$HELMIWRT_FILENAME"
# Build Firmware $SOURCE_BRANCH
sudo chmod +x make
sudo ./make -b $PROC_LISTS -k $KERNEL_VR -s $ROOTFS_SIZE -r $KERNEL_REPO -a true
export PACKAGED_OUTPUTPATH="${PWD}/out"
echo "PACKAGED_OUTPUTPATH=$PACKAGED_OUTPUTPATH" >> $GITHUB_ENV
find . -type f -name 'helmiwrt-$SOURCE_BRANCH-*' | while read FILE ; do
echo -e $(readlink -f ${FILE}) ;
done
echo "status=success" >> $GITHUB_OUTPUT
fi
echo "Building done!. resuming..."
- name: Checking Release Status
id: release_status
run: |
export REL_STATS="$(curl -s https://github.com/$UP_USERNEW/$UP_NEW/releases | grep -c 'Latest')"
echo "REL_STATS=$REL_STATS" >> $GITHUB_ENV
if [[ $REL_STATS -lt 1 ]]; then
echo "PRE_RELEASE_STATS=true" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
else
echo "PRE_RELEASE_STATS=false" >> $GITHUB_ENV
echo "status=success" >> $GITHUB_OUTPUT
fi
echo "Checking release done!. resuming..."
- name: Upload Firmware Files to GitHub Release
uses: ncipollo/release-action@v1.12.0
if: steps.build.outputs.status == 'success' && steps.release_status.outputs.status == 'success' && !cancelled()
with:
prerelease: ${{ env.PRE_RELEASE_STATS }}
allowUpdates: true
replacesArtifacts: true
owner: ${{ env.UP_USERNEW }}
repo: ${{ env.UP_NEW }}
name: HelmiWrt OS ${{ env.BUILD_DATE }}
token: ${{ secrets.HELMIWRT_RW }}
tag: helmiwrt-${{ env.BUILD_DATE }}
artifacts: ${{ env.PACKAGED_OUTPUTPATH }}/helmiwrt-*
bodyFile: release_body.txt
- name: Upload RootFS File to Current Repo
uses: ncipollo/release-action@v1.12.0
if: steps.build.outputs.status == 'success' && steps.release_status.outputs.status == 'success' && !cancelled()
with:
prerelease: ${{ env.PRE_RELEASE_STATS }}
allowUpdates: true
replacesArtifacts: true
owner: helmiau
repo: HelmiWrt-OS-Immortal
name: HelmiWrt OS ${{ env.BUILD_DATE }}
token: ${{ secrets.HELMIWRT_RW }}
tag: helmiwrt-${{ env.BUILD_DATE }}
artifacts: ${{ env.OPENWRTROOT }}/openwrt-armvirt/${{ env.HELMIWRT_FILENAME }}
bodyFile: release_body.txt