优化 CI 构建流程
Some checks failed
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 29s
Build and Release / build-and-test (amd64, ubuntu) (push) Failing after 16m22s
Build and Release / build-and-test (amd64, alpine) (push) Failing after 16m24s
Build and Release / build-and-test (arm64, alpine) (push) Successful in 28m28s
Build and Release / release (push) Has been skipped

This commit is contained in:
2025-12-08 11:04:48 +08:00
parent ae710732aa
commit b16da1a3c5
4 changed files with 27 additions and 12 deletions

17
debian/build-deb.sh vendored
View File

@@ -12,7 +12,10 @@ ARCH=$1
VERSION=$2
TARGZ_FILE=$3
PKG_NAME="p2pool"
DEB_FILE="${PKG_NAME}_${VERSION}_${ARCH}.deb"
# Strip 'v' prefix from version if present (Debian versions must start with digit)
DEB_VERSION="${VERSION#v}"
DEB_FILE="${PKG_NAME}_${DEB_VERSION}_${ARCH}.deb"
# 转换架构名称Docker 使用的架构名到 Debian 架构名)
case "$ARCH" in
@@ -30,7 +33,7 @@ esac
echo "📦 Building Debian package: ${DEB_FILE}"
echo " Architecture: ${DEB_ARCH}"
echo " Version: ${VERSION}"
echo " Version: ${DEB_VERSION} (from ${VERSION})"
echo " Source: ${TARGZ_FILE}"
# 创建临时目录
@@ -38,19 +41,19 @@ BUILD_DIR=$(mktemp -d)
trap "rm -rf $BUILD_DIR" EXIT
# 创建包目录结构
PKG_DIR="${BUILD_DIR}/${PKG_NAME}_${VERSION}_${DEB_ARCH}"
PKG_DIR="${BUILD_DIR}/${PKG_NAME}_${DEB_VERSION}_${DEB_ARCH}"
mkdir -p "${PKG_DIR}/DEBIAN"
mkdir -p "${PKG_DIR}/usr/local/bin"
mkdir -p "${PKG_DIR}/opt/p2pool"
mkdir -p "${PKG_DIR}/lib/systemd/system"
mkdir -p "${PKG_DIR}/etc/p2pool"
# 解压二进制文件
echo "📂 Extracting binaries..."
tar -xzf "${TARGZ_FILE}" -C "${PKG_DIR}/usr/local/bin"
tar -xzf "${TARGZ_FILE}" -C "${PKG_DIR}/opt/p2pool"
# 生成 control 文件
echo "📝 Generating control file..."
sed -e "s/{{VERSION}}/${VERSION}/" \
sed -e "s/{{VERSION}}/${DEB_VERSION}/" \
-e "s/{{ARCH}}/${DEB_ARCH}/" \
debian/control.template > "${PKG_DIR}/DEBIAN/control"
@@ -68,7 +71,7 @@ echo "🔧 Installing systemd service..."
cp debian/p2pool.service "${PKG_DIR}/lib/systemd/system/"
# 设置权限
chmod 755 "${PKG_DIR}/usr/local/bin/p2pool"
chmod 755 "${PKG_DIR}/opt/p2pool/p2pool"
chmod 644 "${PKG_DIR}/lib/systemd/system/p2pool.service"
# 构建 deb 包