修改11
All checks were successful
Build and Release / build-and-test (arm64, alpine) (push) Successful in 7s
Build and Release / build-and-test (arm64, ubuntu) (push) Successful in 7s
Build and Release / build-and-test (amd64, alpine) (push) Successful in 14s
Build and Release / build-and-test (amd64, ubuntu) (push) Successful in 14s
Build and Release / docker-images (push) Successful in 25s
Build and Release / release (push) Successful in 27s

This commit is contained in:
2025-12-02 14:41:55 +08:00
parent d1cfd6025e
commit 47c0c4de32

View File

@@ -164,21 +164,28 @@ jobs:
env: env:
TOKEN: ${{ secrets.BUILD_TOKEN }} TOKEN: ${{ secrets.BUILD_TOKEN }}
TAG: ${{ github.ref_name }} TAG: ${{ github.ref_name }}
REGISTRY: ${{ gitea.server_url }}
OWNER: ${{ gitea.repository_owner }}
REPO: ${{ gitea.repository }}
run: | run: |
cd packages cd packages
# 上传所有包 # 提取仓库信息(移除 https:// 前缀和仓库路径)
REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https\?://||')
OWNER="${{ gitea.repository_owner }}"
REPO_NAME=$(echo "${{ gitea.repository }}" | cut -d'/' -f2)
echo "📦 上传包到 Generic Package Registry..." echo "📦 上传包到 Generic Package Registry..."
echo " Registry: ${REGISTRY}"
echo " Owner: ${OWNER}"
echo " Package: ${PRODUCT_NAME}"
echo " Version: ${TAG}"
# 上传所有包 (使用 PUT 方法)
for file in *.tar.gz; do for file in *.tar.gz; do
[ ! -f "$file" ] && continue [ ! -f "$file" ] && continue
echo " ⬆️ $file" echo " ⬆️ $file"
curl -fsSL -X POST \ curl -fsSL -X PUT \
-H "Authorization: token ${TOKEN}" \ -H "Authorization: token ${TOKEN}" \
-F "file=@$file" \ --upload-file "$file" \
"${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/$file" || { "https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/$file" || {
echo "❌ 上传失败: $file" echo "❌ 上传失败: $file"
exit 1 exit 1
} }
@@ -188,7 +195,7 @@ jobs:
echo "📝 生成 Release 描述..." echo "📝 生成 Release 描述..."
BODY="## Release ${TAG}\n\n### 📥 下载链接\n" BODY="## Release ${TAG}\n\n### 📥 下载链接\n"
for file in *.tar.gz; do for file in *.tar.gz; do
[ -f "$file" ] && BODY="${BODY}- [${file}](${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/${file})\n" [ -f "$file" ] && BODY="${BODY}- [${file}](https://${REGISTRY}/api/packages/${OWNER}/generic/${PRODUCT_NAME}/${TAG}/${file})\n"
done done
# 创建 Release # 创建 Release
@@ -196,7 +203,7 @@ jobs:
curl -fsSL -X POST \ curl -fsSL -X POST \
-H "Authorization: token ${TOKEN}" \ -H "Authorization: token ${TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
"${REGISTRY}/api/v1/repos/${REPO}/releases" \ "https://${REGISTRY}/api/v1/repos/${{ gitea.repository }}/releases" \
-d @- << EOF || echo "⚠️ Release 可能已存在" -d @- << EOF || echo "⚠️ Release 可能已存在"
{ {
"tag_name": "${TAG}", "tag_name": "${TAG}",