update demo.yaml

This commit is contained in:
hhjmk 2025-08-23 00:18:38 +08:00
parent c9df7fa971
commit 14466005f6
8 changed files with 140 additions and 0 deletions

140
.gitea/workflows/demo.yaml Normal file
View File

@ -0,0 +1,140 @@
# .drone.yml
kind: pipeline
type: docker
name: SkyHawk-SHRP
# 允许手动触发并传入参数
trigger:
event:
- custom
# 定义输入参数(对应 GitHub Actions 的 workflow_dispatch.inputs
params:
- MANIFEST=https://github.com/SHRP-Reborn/manifest.git
- MANIFEST_BRANCH=shrp-9.0
- DEVICE_TREE=https://github.com/mlm-games/twrp_lenovo_7305x_m7_mt8765_P
- DEVICE_TREE_BRANCH=shrp-9.0
- DEVICE_PATH=device/lenovo/mt8765_P
- DEVICE_NAME=mt8765_P
- BUILD_TARGET=recovery
- LDCHECK=false
- LDCHECKPATH=system/bin/qseecomd
# 整个 job 的环境变量
environment:
OUTPUT_DIR: /drone/src/android-recovery/out/target/product
GITEA_TOKEN:
from_secret: gitea_token # 在仓库设置里预先填好 Secret
steps:
- name: display-params
image: alpine
commands:
- echo "Manifest Branch: $MANIFEST_BRANCH"
- echo "Device Tree: $DEVICE_TREE"
- echo "Device Branch: $DEVICE_TREE_BRANCH"
- echo "Build Target: ${BUILD_TARGET}image"
- name: install-deps
image: ubuntu:20.04
commands:
- apt-get update -qq
- DEBIAN_FRONTEND=noninteractive apt-get -y install gperf gcc-multilib gcc-10-multilib g++-multilib g++-10-multilib libc6-dev lib32ncurses5-dev x11proto-core-dev libx11-dev tree lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc bc ccache lib32readline-dev lib32z1-dev liblz4-tool libncurses5-dev libsdl1.2-dev libwxgtk3.0-gtk3-dev libxml2 lzop pngcrush schedtool squashfs-tools imagemagick libbz2-dev lzma ncftp qemu-user-static libstdc++-10-dev libtinfo5 libgflags-dev libncurses5 python3 curl git openjdk-8-jdk unzip python2
- name: set-swap
image: ubuntu:20.04
privileged: true
commands:
- fallocate -l 12G /swapfile
- chmod 600 /swapfile
- mkswap /swapfile
- swapon /swapfile
- swapon -s
- name: setup-ccache
image: ubuntu:20.04
environment:
CCACHE_DIR: /ccache
volumes:
- name: ccache
path: /ccache
commands:
- ccache -M 10G
- ccache -s
- name: repo-init
image: ubuntu:20.04
environment:
GIT_AUTHOR_NAME: drone-ci
GIT_AUTHOR_EMAIL: drone@example.com
commands:
- curl https://storage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
- chmod +x /usr/local/bin/repo
- mkdir android-recovery && cd android-recovery
- repo init --depth=1 -u "$MANIFEST" -b "$MANIFEST_BRANCH"
- repo sync -j$(nproc --all) --force-sync --no-clone-bundle --no-tags
- name: clone-device-tree
image: ubuntu:20.04
commands:
- cd android-recovery
- git clone "$DEVICE_TREE" -b "$DEVICE_TREE_BRANCH" "./$DEVICE_PATH"
- cd "$DEVICE_PATH" && echo "COMMIT_ID=$(git rev-parse HEAD)" >> /drone/env
- name: pick-makefile
image: ubuntu:20.04
commands:
- cd android-recovery
- |
if [ -f "$DEVICE_PATH/twrp_${DEVICE_NAME}.mk" ]; then
echo "DEVICE_MAKEFILE=twrp_${DEVICE_NAME}" >> /drone/env
elif [ -f "$DEVICE_PATH/omni_${DEVICE_NAME}.mk" ]; then
echo "DEVICE_MAKEFILE=omni_${DEVICE_NAME}" >> /drone/env
else
echo "No recovery makefile found!" && exit 1
fi
- name: build
image: ubuntu:20.04
volumes:
- name: ccache
path: /ccache
commands:
- . /drone/env
- cd android-recovery
- source build/envsetup.sh
- export ALLOW_MISSING_DEPENDENCIES=true
- lunch ${DEVICE_MAKEFILE}-eng
- make clean
- mka ${BUILD_TARGET}image -j$(nproc --all)
- name: post-check
image: alpine
commands:
- . /drone/env
- img_file=$(find "$OUTPUT_DIR/$DEVICE_NAME" -name "${BUILD_TARGET}*.img" | head -n1)
- [ -f "$img_file" ] || exit 1
- echo "BUILD_DATE=$(date +%Y%m%d)" >> /drone/env
- name: release
image: plugins/gitea-release
settings:
base_url: https://git.example.com # 改成你自己的 Gitea 域名
api_key:
from_secret: gitea_token
files:
- "${OUTPUT_DIR}/${DEVICE_NAME}/${BUILD_TARGET}.img"
- "${OUTPUT_DIR}/${DEVICE_NAME}/SHRP*.zip"
title: "Unofficial SHRP for ${DEVICE_NAME} // ${BUILD_DATE}"
note: |
Build: ${MANIFEST_BRANCH}
Device: [Device Tree](${DEVICE_TREE}/tree/${DEVICE_TREE_BRANCH})
Commit: [${COMMIT_ID}](${DEVICE_TREE}/commit/${COMMIT_ID})
prerelease: true
when:
status: success
volumes:
- name: ccache
host:
path: /var/lib/drone/ccache