Skip to content

Commit

Permalink
测试功能
Browse files Browse the repository at this point in the history
  • Loading branch information
khaos committed Dec 7, 2024
1 parent 3029a2e commit 277840a
Showing 1 changed file with 38 additions and 40 deletions.
78 changes: 38 additions & 40 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: CI

on:
push:
branches:
- main
workflow_dispatch: # 手动触发工作流

jobs:
build:
Expand Down Expand Up @@ -40,41 +38,41 @@ jobs:
- name: 验证 Gradle 安装
run: gradle -v

# - name: 设置 gradlew 可执行权限
# run: |
# chmod +x ./gradlew
# ls -l ./gradlew # 检查文件权限,确认是否为可执行
#
# - name: 使用 Gradle Wrapper 构建
# if: env.should_build == 'true'
# run: |
# ./gradlew clean assembleCompatibleRelease
- name: 设置 gradlew 可执行权限
run: |
chmod +x ./gradlew
ls -l ./gradlew # 检查文件权限,确认是否为可执行
- name: 使用 Gradle Wrapper 构建
if: env.should_build == 'true'
run: |
./gradlew clean assembleCompatibleRelease
- name: 延迟等待文件生成
if: env.should_build == 'true'
run: |
echo "等待 5 秒以确保 APK 文件生成完成..."
sleep 5 # 延迟 5 秒
- name: 检查 APK 文件是否存在
if: env.should_build == 'true'
run: |
APK_FILE=$(ls build/outputs/apk/compatible/release/*.apk | head -n 1)
if [[ -z "$APK_FILE" ]]; then
echo "未找到 APK 文件,构建可能未成功"
exit 1
else
echo "找到 APK 文件: $APK_FILE"
echo "APK_FILE=$APK_FILE" >> $GITHUB_ENV
fi
# - name: 延迟等待文件生成
# if: env.should_build == 'true'
# run: |
# echo "等待 5 秒以确保 APK 文件生成完成..."
# sleep 5 # 延迟 5 秒
#
# - name: 检查 APK 文件是否存在
# if: env.should_build == 'true'
# run: |
# APK_FILE=$(ls build/outputs/apk/compatible/release/*.apk | head -n 1)
# if [[ -z "$APK_FILE" ]]; then
# echo "未找到 APK 文件,构建可能未成功"
# exit 1
# else
# echo "找到 APK 文件: $APK_FILE"
# echo "APK_FILE=$APK_FILE" >> $GITHUB_ENV
# fi
#
# - name: 发布到 GitHub
# if: env.should_build == 'true'
# uses: softprops/action-gh-release@v1
# with:
# tag_name: ${{ env.RELEASE_TAG }}
# name: "XQE_lazy_${{ env.TAGS }}" # 自定义发布标题
# body: ${{ env.CHANGELOG }} # 更新日志
# files: ${{ env.APK_FILE }} # 发布最新的 APK 文件
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 发布到 GitHub
if: env.should_build == 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.RELEASE_TAG }}
name: "XQE_lazy_${{ env.TAGS }}" # 自定义发布标题
body: ${{ env.CHANGELOG }} # 更新日志
files: ${{ env.APK_FILE }} # 发布最新的 APK 文件
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 277840a

Please sign in to comment.