feat: 完善 GitHub Actions 工作流和构建系统

- 添加自动下载缺失文件功能,支持 .xz 压缩格式
- 优化构建流程,增加文件清理和压缩功能
- 修复发布资产上传步骤,确保预发布标记正确设置
- 调整发布标签格式,包含版本号、设备目标和运行 ID
- 升级 Actions 版本,使用 softprops/action-gh-release@v1
- 移除 NFS 挂载依赖,简化部署流程
- 增强错误处理和日志输出
This commit is contained in:
mofeng-git
2025-08-20 16:12:40 +08:00
parent 6002dfd9c7
commit c8d1dcca30
8 changed files with 373 additions and 25 deletions

View File

@@ -26,11 +26,10 @@ jobs:
TZ: Asia/Shanghai
volumes:
- /dev:/dev
- /mnt/nfs/lfs/:/mnt/nfs/lfs/
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Install dependencies
run: |
@@ -38,7 +37,7 @@ jobs:
export DEBIAN_FRONTEND=noninteractive
apt-get install -y --no-install-recommends \
sudo tzdata docker.io qemu-utils qemu-user-static binfmt-support parted e2fsprogs \
curl tar python3 python3-pip rsync git android-sdk-libsparse-utils coreutils zerofree
curl tar python3 python3-pip rsync git android-sdk-libsparse-utils coreutils zerofree wget
apt-get clean
rm -rf /var/lib/apt/lists/*
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime
@@ -59,16 +58,16 @@ jobs:
echo "Build script finished."
env:
CI_PROJECT_DIR: ${{ github.workspace }}
GITHUB_ACTIONS: true
OUTPUTDIR: ${{ github.workspace }}/output
- name: Upload artifact
uses: actions/upload-artifact@v3
- name: Create GitHub Release
id: release
uses: softprops/action-gh-release@v1
with:
name: onekvm-image-${{ github.event.inputs.device_target }}-${{ env.BUILD_DATE }}
path: |
${{ github.workspace }}/output/*.img
${{ github.workspace }}/output/*.vmdk
${{ github.workspace }}/output/*.vdi
${{ github.workspace }}/output/*.burn.img
if-no-files-found: ignore
tag_name: v${{ env.BUILD_DATE }}-${{ github.event.inputs.device_target }}-${{ github.run_id }}
name: CI Build ${{ github.event.inputs.device_target }} ${{ env.BUILD_DATE }}
files: ${{ github.workspace }}/output/*.xz
prerelease: true
env:
CI_PROJECT_DIR: ${{ github.workspace }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}