Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51d7a66c56 | ||
|
|
e10f3e5b37 | ||
|
|
b18c672d60 |
@@ -134,40 +134,39 @@ jobs:
|
||||
}
|
||||
done
|
||||
|
||||
# 上传 Debian 包到 Debian Package Registry
|
||||
# 上传 Debian 包到 Debian Package Registry (支持多个发行版)
|
||||
echo ""
|
||||
echo "📦 上传 Debian 包到 Debian Package Registry..."
|
||||
for file in *.deb; do
|
||||
[ ! -f "$file" ] && continue
|
||||
echo " ⬆️ $file"
|
||||
|
||||
# 上传到 bookworm (Debian 12)
|
||||
echo " ⬆️ $file → bookworm"
|
||||
curl -fsSL -X PUT \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
--upload-file "$file" \
|
||||
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/bookworm/main/upload" || {
|
||||
echo "❌ Debian 包上传失败: $file"
|
||||
echo "❌ Debian 包上传失败: $file (bookworm)"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 上传到 trixie (Debian 13)
|
||||
echo " ⬆️ $file → trixie"
|
||||
curl -fsSL -X PUT \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
--upload-file "$file" \
|
||||
"https://${REGISTRY}/api/packages/${OWNER}/debian/pool/trixie/main/upload" || {
|
||||
echo "❌ Debian 包上传失败: $file (trixie)"
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
# 生成 Release 描述(包含 Package Registry 和 Release 附件两种下载方式)
|
||||
# 生成 Release JSON payload
|
||||
echo ""
|
||||
echo "📝 生成 Release 描述..."
|
||||
BODY="## Release ${TAG}\n\n"
|
||||
BODY="${BODY}### 📥 下载方式\n\n"
|
||||
BODY="${BODY}#### 方式 1: 直接下载(推荐)\n\n"
|
||||
BODY="${BODY}点击下面 **Assets** 部分的文件名直接下载。\n\n"
|
||||
BODY="${BODY}#### 方式 2: Generic Package Registry\n\n"
|
||||
for file in *.tar.gz; do
|
||||
[ -f "$file" ] && BODY="${BODY}- [\`${file}\`](https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/${file})\n"
|
||||
done
|
||||
BODY="${BODY}\n#### 方式 3: Debian Repository\n\n"
|
||||
BODY="${BODY}\`\`\`bash\n"
|
||||
BODY="${BODY}# Add repository\n"
|
||||
BODY="${BODY}echo \"deb https://${REGISTRY}/api/packages/${OWNER}/debian bookworm main\" | sudo tee /etc/apt/sources.list.d/xxxigcc-proxy.list\n\n"
|
||||
BODY="${BODY}# Update and install\n"
|
||||
BODY="${BODY}sudo apt-get update\n"
|
||||
BODY="${BODY}sudo apt-get install xxxigcc-proxy\n"
|
||||
BODY="${BODY}\`\`\`\n"
|
||||
echo "📝 生成 Release..."
|
||||
|
||||
export REGISTRY OWNER TAG
|
||||
RELEASE_DATA=$(python3 -c 'import json,glob,os;r=os.environ["REGISTRY"];o=os.environ["OWNER"];p=os.environ["PRODUCT_NAME"];t=os.environ["TAG"];b=["## Release "+t,"","### 📥 下载方式","","#### 方式 1: 直接下载(推荐)","","点击下面 **Assets** 部分的文件名直接下载。","","#### 方式 2: Generic Package Registry",""]+[f"- [`{f}`](https://{r}/api/packages/{o}/generic/{p}/{t}/{f})" for f in sorted(glob.glob("*.tar.gz"))]+["","#### 方式 3: Debian Repository","","**Debian 12 (bookworm):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian bookworm main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install xxxigcc-proxy","```","","**Debian 13 (trixie):**","","```bash","# Download GPG key",f"sudo curl https://{r}/api/packages/{o}/debian/repository.key -o /etc/apt/keyrings/gitea-{o}.asc","","# Add repository",f"echo \"deb [signed-by=/etc/apt/keyrings/gitea-{o}.asc] https://{r}/api/packages/{o}/debian trixie main\" | sudo tee -a /etc/apt/sources.list.d/{o}.list","","# Update and install","sudo apt-get update","sudo apt-get install xxxigcc-proxy","```"];print(json.dumps({"tag_name":t,"name":f"Release {t}","body":"\n".join(b),"draft":False,"prerelease":False}))')
|
||||
|
||||
# 创建 Release
|
||||
echo ""
|
||||
@@ -176,16 +175,7 @@ jobs:
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H "Content-Type: application/json" \
|
||||
"https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases" \
|
||||
-d @- << EOF
|
||||
{
|
||||
"tag_name": "${TAG}",
|
||||
"name": "Release ${TAG}",
|
||||
"body": "${BODY}",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}
|
||||
EOF
|
||||
)
|
||||
-d "${RELEASE_DATA}")
|
||||
|
||||
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
|
||||
RESPONSE_BODY=$(echo "$RESPONSE" | head -n-1)
|
||||
@@ -226,3 +216,6 @@ jobs:
|
||||
echo ""
|
||||
echo "✅ Release 创建完成!"
|
||||
echo "🔗 访问: https://${REGISTRY}/${{ gitea.repository }}/releases/tag/${TAG}"
|
||||
|
||||
# 清理临时文件
|
||||
rm -f release_body.md
|
||||
|
||||
Reference in New Issue
Block a user