更新 .gitea/workflows/master.yml
Some checks failed
Uniapp 自动化打包 CI/CD / 打包 Uniapp 项目 (push) Failing after 2s
Some checks failed
Uniapp 自动化打包 CI/CD / 打包 Uniapp 项目 (push) Failing after 2s
This commit is contained in:
@@ -11,7 +11,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: 打包 Uniapp 项目
|
name: 打包 Uniapp 项目
|
||||||
runs-on: ubuntu # 云 Runner 环境(自建 Runner 可替换为自定义名称)
|
runs-on: windows # 云 Runner 环境(自建 Runner 可替换为自定义名称)
|
||||||
steps:
|
steps:
|
||||||
########################################################################
|
########################################################################
|
||||||
# 步骤 1:检出 Gitea 代码
|
# 步骤 1:检出 Gitea 代码
|
||||||
@@ -51,10 +51,10 @@ jobs:
|
|||||||
# 解压到目标目录
|
# 解压到目标目录
|
||||||
# unzip -q hbuilderx.zip -d /hbuilderxcli/HBuilderX
|
# unzip -q hbuilderx.zip -d /hbuilderxcli/HBuilderX
|
||||||
# 赋予 CLI 执行权限
|
# 赋予 CLI 执行权限
|
||||||
sudo chmod +x /hbuilderxcli/HBuilderX/cli
|
# sudo chmod +x /hbuilderxcli/HBuilderX/cli
|
||||||
# 验证 CLI 版本(确保部署成功)
|
# 验证 CLI 版本(确保部署成功)
|
||||||
/hbuilderxcli/HBuilderX/cli -v
|
C:\Users\Administrator\Desktop\runner\HBuilderX\cli -v
|
||||||
echo "HBuilderX CLI 部署完成,路径:/hbuilderxcli/HBuilderX/cli"
|
echo "HBuilderX CLI 部署完成,路径:C:\Users\Administrator\Desktop\runner\HBuilderX\cli"
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# 步骤 5:HBuilderX 密钥登录(安全读取账户信息)
|
# 步骤 5:HBuilderX 密钥登录(安全读取账户信息)
|
||||||
@@ -64,7 +64,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo "开始登录 HBuilderX 账户..."
|
echo "开始登录 HBuilderX 账户..."
|
||||||
# 执行登录命令(读取 Gitea Secrets 中的账户密码)
|
# 执行登录命令(读取 Gitea Secrets 中的账户密码)
|
||||||
LOGIN_OUTPUT=$(/hbuilderxcli/HBuilderX/cli user login --username ${{ secrets.HBUILDERX_USERNAME }} --password ${{ secrets.HBUILDERX_PASSWORD }})
|
LOGIN_OUTPUT=$(C:\Users\Administrator\Desktop\runner\HBuilderX\cli user login --username ${{ secrets.HBUILDERX_USERNAME }} --password ${{ secrets.HBUILDERX_PASSWORD }})
|
||||||
# 打印登录输出(便于调试,无敏感信息)
|
# 打印登录输出(便于调试,无敏感信息)
|
||||||
echo "登录结果:$LOGIN_OUTPUT"
|
echo "登录结果:$LOGIN_OUTPUT"
|
||||||
# 验证登录是否成功(根据文档,成功返回 "0:user login:OK")
|
# 验证登录是否成功(根据文档,成功返回 "0:user login:OK")
|
||||||
@@ -84,13 +84,13 @@ jobs:
|
|||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo "正在查询打包队列状态..."
|
echo "正在查询打包队列状态..."
|
||||||
# (可选)提前查询队列(部分场景下 HBuilderX 会返回排队信息)
|
# (可选)提前查询队列(部分场景下 HBuilderX 会返回排队信息)
|
||||||
/hbuilderxcli/HBuilderX/cli publish --platform android --query-queue
|
C:\Users\Administrator\Desktop\runner\HBuilderX\cli publish --platform android --query-queue
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
echo "开始执行打包(实时输出进度)..."
|
echo "开始执行打包(实时输出进度)..."
|
||||||
# 执行打包命令(根据目标平台调整 --platform 参数,支持 android/ios/h5 等)
|
# 执行打包命令(根据目标平台调整 --platform 参数,支持 android/ios/h5 等)
|
||||||
# --project:指定项目根目录(当前检出目录)
|
# --project:指定项目根目录(当前检出目录)
|
||||||
# --output:指定产物输出目录(便于后续归档)
|
# --output:指定产物输出目录(便于后续归档)
|
||||||
BUILD_OUTPUT=$(/hbuilderxcli/HBuilderX/cli publish \
|
BUILD_OUTPUT=$(C:\Users\Administrator\Desktop\runner\HBuilderX\cli publish \
|
||||||
--platform android \
|
--platform android \
|
||||||
--project ./ \
|
--project ./ \
|
||||||
--output ./unpackage/dist/build/android \
|
--output ./unpackage/dist/build/android \
|
||||||
@@ -123,7 +123,7 @@ jobs:
|
|||||||
- name: 8. HBuilderX 账户登出
|
- name: 8. HBuilderX 账户登出
|
||||||
run: |
|
run: |
|
||||||
echo "开始登出 HBuilderX 账户..."
|
echo "开始登出 HBuilderX 账户..."
|
||||||
LOGOUT_OUTPUT=$(/hbuilderxcli/HBuilderX/cli user logout)
|
LOGOUT_OUTPUT=$(C:\Users\Administrator\Desktop\runner\HBuilderX\cli user logout)
|
||||||
echo "登出结果:$LOGOUT_OUTPUT"
|
echo "登出结果:$LOGOUT_OUTPUT"
|
||||||
# 验证登出是否成功(根据文档,成功返回 "0:user logout:OK")
|
# 验证登出是否成功(根据文档,成功返回 "0:user logout:OK")
|
||||||
if [[ $(echo "$LOGOUT_OUTPUT" | grep -c "0:user logout:OK") -eq 0 ]]; then
|
if [[ $(echo "$LOGOUT_OUTPUT" | grep -c "0:user logout:OK") -eq 0 ]]; then
|
||||||
|
Reference in New Issue
Block a user