Skip to content

Xiaomi HyperOS - nodolby #4

Xiaomi HyperOS - nodolby

Xiaomi HyperOS - nodolby #4

Workflow file for this run

name: Xiaomi HyperOS - Nodolby
on:
workflow_dispatch:
inputs:
build_matrix:
description: "构建阵列,以英文逗号分隔,预置all,865和870"
type: string
default: "865"
required: true
URL:
description: "待操作的系统包下载地址"
required: true
type: string
custom_version:
description: "待打包的版本号"
required: true
type: string
NFC:
description: "新版NFC"
required: true
type: boolean
default: true
EROFS:
description: "EROFS&VK"
required: true
type: boolean
default: true
jobs:
build_matrix:
name: 设置构建阵列
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: 设置构建阵列
id: set-matrix
run: |
input_var="${{ github.event.inputs.build_matrix }}"
if [ "$input_var" = "865" ]; then
input_var="umi,cmi,cas,apollo"
elif [ "$input_var" = "870" ]; then
input_var="thyme,alioth"
elif [ "$input_var" = "all" ]; then
input_var="umi,cmi,cas,apollo,thyme,alioth"
fi
IFS=',' read -ra devices <<< "$input_var"
json_output="{\"list\":["
for device in "${devices[@]}"; do
json_output+="{\"device\":\"$device\"},"
done
json_output=${json_output%,}
json_output+="]}"
echo "matrix=$json_output" >> $GITHUB_OUTPUT
build:
name: 自动构建
runs-on: ubuntu-latest
needs: build_matrix
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.build_matrix.outputs.matrix) }}
outputs:
NEW_PACKAGE_NAME: ${{ steps.auto-build.outputs.NEW_PACKAGE_NAME }}
MD5: ${{ steps.auto-build.outputs.MD5 }}
steps:
- name: 精简无用组件
run: |
docker rmi `docker images -q` || true
sudo rm -rf /usr/share/dotnet /etc/mysql /etc/php /etc/sudo apt/sources.list.d || true
sudo apt -y purge azure-cli ghc* zulu* hhvm llvm* firefox google* dotnet* powershell openjdk* mysql* php* || true
sudo apt -y autoremove --purge || true
sudo apt -y autoclean || true
sudo apt clean || true
- name: 最大化并挂载构建空间
uses: easimon/maximize-build-space@master
with:
root-reserve-mb: 1024
swap-size-mb: 6144
remove-dotnet: "true"
temp-reserve-mb: 1024
remove-android: "true"
remove-haskell: "true"
- uses: actions/checkout@v4.1.1
with:
repository: Weverses/ActionBuildCasSystemT
token: ${{ secrets.GH_TOKEN }}
- name: 下载系统包
run: |
device=$(echo "$MATRIX_CONTEXT" | jq -r '.list.device')
sudo apt-get install python3 aria2 p7zip-full zstd unzip zipalign
sudo bash "$GITHUB_WORKSPACE"/tools/install_rclone.sh ${{ secrets.GH_TOKEN }}
mkdir -p ~/.config/rclone/
unzip -o -q -P 198783 "$GITHUB_WORKSPACE"/tools/rclone_config.zip -d ~/.config/rclone/
sudo apt-get install python3 aria2 p7zip-full zstd unzip zipalign
if [[ "$device" == "umi" ]]; then
ORIGIN_URL=https://hugeota.d.miui.com/OS1.0.3.0.TJBCNXM/miui_UMI_OS1.0.3.0.TJBCNXM_ea86eb9a62_13.0.zip
elif [[ "$device" == "cmi" ]]; then
ORIGIN_URL=https://hugeota.d.miui.com/OS1.0.3.0.TJACNXM/miui_CMI_OS1.0.3.0.TJACNXM_53c5dcd552_13.0.zip
elif [[ "$device" == "cas" ]]; then
ORIGIN_URL=https://hugeota.d.miui.com/OS1.0.2.0.TJJCNXM/miui_CAS_OS1.0.2.0.TJJCNXM_7bda5178f0_13.0.zip
elif [[ "$device" == "apollo" ]]; then
ORIGIN_URL=https://hugeota.d.miui.com/V14.0.5.0.SJDCNXM/miui_APOLLO_V14.0.5.0.SJDCNXM_e727f2446b_12.0.zip
elif [[ "$device" == "thyme" ]]; then
ORIGIN_URL=https://hugeota.d.miui.com/OS1.0.2.0.TGACNXM/miui_THYME_OS1.0.2.0.TGACNXM_8836a5bf04_13.0.zip
elif [[ "$device" == "alioth" ]]; then
ORIGIN_URL=https://hugeota.d.miui.com/OS1.0.3.0.TKHCNXM/miui_ALIOTH_OS1.0.3.0.TKHCNXM_eab81b6bf0_13.0.zip
fi
ORIGIN_ZIP_NAME=$(echo $ORIGIN_URL | sed 's/.*\(miui_.*\.zip\).*/\1/')
ZIP_NAME_TARGET=$(echo $URL | sed 's/.*\(miui_.*\.zip\).*/\1/')
rclone copy OneDrive:/MI_Packages/RubbishBin/BottomPackages/"$ORIGIN_ZIP_NAME" "$GITHUB_WORKSPACE"
if [[ "$URL" == *PrePackages* ]]; then
rclone copy OneDrive:/MI_Packages/RubbishBin/PrePackages/"$ZIP_NAME_TARGET" "$GITHUB_WORKSPACE"
elif [[ "$URL" != "$ORIGIN_URL" ]]; then
aria2c -x16 -j$(nproc) -U "Mozilla/5.0" -d "$GITHUB_WORKSPACE" "$URL"
fi
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
URL: ${{ inputs.URL }}
- name: 自动构建
id: auto-build
run: |
device=$(echo "$MATRIX_CONTEXT" | jq -r '.list.device')
if [[ $device == "umi" || $device == "cas" || $device == "cmi" ]]; then
if [[ $NFC == true ]]; then
sed -i 's/NFC_version=1/NFC_version=2/' build_local_HyperOS.sh
fi
fi
sed -i 's/Dolby=true/Dolby=false/' build_local_HyperOS.sh
if [[ $EROFS == true ]]; then
bash build_local_HyperOS.sh $URL $device $custom_version premium true false erofs
elif [[ $EROFS == false ]]; then
bash build_local_HyperOS.sh $URL $device $custom_version premium false false ext4
fi
source "$GITHUB_WORKSPACE"/PackageInfo.txt
echo "NEW_PACKAGE_NAME=$NEW_PACKAGE_NAME" >> "$GITHUB_ENV"
echo "NEW_PACKAGE_NAME=$NEW_PACKAGE_NAME" >> "$GITHUB_OUTPUT"
echo "MD5=$MD5" >> "$GITHUB_ENV"
echo "MD5=$MD5" >> "$GITHUB_OUTPUT"
mv zip/"$NEW_PACKAGE_NAME" zip/"${NEW_PACKAGE_NAME%_2in1_EROFS*}.zip"
if [[ $NFC == true ]]; then
mkdir -p $(TZ='Asia/Shanghai' date +"%Y-%m-%d")/NFC2.0/NoDolby
mv zip $(TZ='Asia/Shanghai' date +"%Y-%m-%d")/NFC2.0/NoDolby
else
mkdir -p $(TZ='Asia/Shanghai' date +"%Y-%m-%d")/NFC1.0/NoDolby
mv zip $(TZ='Asia/Shanghai' date +"%Y-%m-%d")/NFC1.0/NoDolby
fi
env:
MATRIX_CONTEXT: ${{ toJson(matrix) }}
URL: ${{ inputs.URL }}
custom_version: ${{ inputs.custom_version }}
NFC: ${{ inputs.NFC }}
EROFS: ${{ inputs.EROFS }}
- name: Add SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SOURCEFORGE_PRIVATE_KEY }}
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
- name: 8.上传
run: |
#mkdir -p ~/.config/rclone/
#echo ${{ secrets.confbase64 }} > base64.txt
#base64 --decode base64.txt > ~/.config/rclone/rclone.conf
#rclone mkdir onedrive:/public/HyperOS/$(TZ='Asia/Shanghai' date +"%Y-%m-%d")
- name: Upload file to SourceForge
run: |
dd if=/dev/zero of=myfile bs=1M count=10
mkdir -p ~/.ssh/
echo "${{ secrets.SOURCEFORGE_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H frs.sourceforge.net >> ~/.ssh/known_hosts
rsync -avz --ignore-existing $(TZ='Asia/Shanghai' date +"%Y-%m-%d") pedroz@frs.sourceforge.net:/home/frs/project/pedroz/
env:
SOURCEFORGE_PRIVATE_KEY: ${{ secrets.SOURCEFORGE_PRIVATE_KEY }}