Skip to content

Add GitHub Actions workflow for multi-platform builds#2

Draft
Copilot wants to merge 3 commits intomasterfrom
copilot/add-github-actions-workflow
Draft

Add GitHub Actions workflow for multi-platform builds#2
Copilot wants to merge 3 commits intomasterfrom
copilot/add-github-actions-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 20, 2026

Adds automated CI/CD pipeline to build Android (APK/AAB), Windows (MSIX), and macOS (Catalyst) packages.

Workflow Configuration

  • Triggers: Push to master/main, tags matching v*, PRs, manual dispatch
  • Permissions: Explicit contents: read for GITHUB_TOKEN security

Build Jobs

Android (ubuntu-latest)

  • Builds both APK and AAB formats for net10.0-android
  • Artifacts: android-apk, android-aab

Windows (windows-latest)

  • Publishes MSIX for net10.0-windows10.0.19041.0 targeting win10-x64
  • Artifacts: windows-msix

macOS (macos-latest)

  • Builds and packages Catalyst app for net10.0-maccatalyst
  • Artifacts: macos-app

All jobs use .NET 10.0.x SDK with MAUI workload installed. Build artifacts are uploaded and accessible from the Actions tab.

jobs:
  build-android:
    runs-on: ubuntu-latest
    steps:
      - name: Build Android APK
        run: dotnet build zuoleme.csproj -c Release -f net10.0-android /p:AndroidPackageFormat=apk
Original prompt

目标

为 zuoleme 项目添加 GitHub Actions 自动打包工作流,支持 Android、Windows 和 macOS 三个平台的自动构建。

具体要求

创建文件 .github/workflows/build.yml,包含以下内容:

1. 工作流触发条件

  • 推送到 mastermain 分支时触发
  • 创建以 v 开头的标签时触发(如 v1.0.0
  • 创建 Pull Request 时触发
  • 支持手动触发(workflow_dispatch)

2. Android 构建任务 (build-android)

  • 运行环境:ubuntu-latest
  • 步骤:
    1. Checkout 代码
    2. 设置 .NET 10.0.x SDK
    3. 安装 MAUI workload
    4. 恢复依赖项
    5. 构建 Android APK (Release 配置,net10.0-android 框架)
    6. 构建 Android AAB (使用 dotnet publish,Release 配置)
    7. 上传 APK 产物到 android-apk
    8. 上传 AAB 产物到 android-aab

3. Windows 构建任务 (build-windows)

  • 运行环境:windows-latest
  • 步骤:
    1. Checkout 代码
    2. 设置 .NET 10.0.x SDK
    3. 安装 MAUI workload
    4. 恢复依赖项
    5. 发布 Windows MSIX (Release 配置,net10.0-windows10.0.19041.0 框架,win10-x64 运行时)
    6. 上传 MSIX 产物到 windows-msix

4. macOS 构建任务 (build-macos)

  • 运行环境:macos-latest
  • 步骤:
    1. Checkout 代码
    2. 设置 .NET 10.0.x SDK
    3. 安装 MAUI workload
    4. 恢复依赖项
    5. 构建 macOS Catalyst (Release 配置,net10.0-maccatalyst 框架)
    6. 发布 macOS Catalyst (使用 CreatePackage=true)
    7. 上传 macOS 应用产物到 macos-app

工作流文件内容

name: Build Multi-Platform

on:
  push:
    branches: [ master, main ]
    tags:
      - 'v*'
  pull_request:
    branches: [ master, main ]
  workflow_dispatch:

jobs:
  build-android:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '10.0.x'

      - name: Install MAUI workload
        run: dotnet workload install maui

      - name: Restore dependencies
        run: dotnet restore zuoleme.csproj

      - name: Build Android APK
        run: dotnet build zuoleme.csproj -c Release -f net10.0-android /p:AndroidPackageFormat=apk

      - name: Build Android AAB
        run: dotnet publish zuoleme.csproj -c Release -f net10.0-android /p:AndroidPackageFormat=aab

      - name: Upload Android APK
        uses: actions/upload-artifact@v4
        with:
          name: android-apk
          path: |
            **/*-Signed.apk
            **/com.linweijian.zuoleme-Signed.apk

      - name: Upload Android AAB
        uses: actions/upload-artifact@v4
        with:
          name: android-aab
          path: |
            **/*-Signed.aab
            **/com.linweijian.zuoleme-Signed.aab

  build-windows:
    runs-on: windows-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '10.0.x'

      - name: Install MAUI workload
        run: dotnet workload install maui

      - name: Restore dependencies
        run: dotnet restore zuoleme.csproj

      - name: Build Windows MSIX
        run: dotnet publish zuoleme.csproj -c Release -f net10.0-windows10.0.19041.0 -p:RuntimeIdentifierOverride=win10-x64

      - name: Upload Windows MSIX
        uses: actions/upload-artifact@v4
        with:
          name: windows-msix
          path: |
            **/AppPackages/**/*.msix
            **/bin/Release/net10.0-windows10.0.19041.0/win10-x64/publish/**

  build-macos:
    runs-on: macos-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Setup .NET
        uses: actions/setup-dotnet@v4
        with:
          dotnet-version: '10.0.x'

      - name: Install MAUI workload
        run: dotnet workload install maui

      - name: Restore dependencies
        run: dotnet restore zuoleme.csproj

      - name: Build macOS Catalyst
        run: dotnet build zuoleme.csproj -c Release -f net10.0-maccatalyst

      - name: Publish macOS Catalyst
        run: dotnet publish zuoleme.csproj -c Release -f net10.0-maccatalyst -p:CreatePackage=true

      - name: Upload macOS App
        uses: actions/upload-artifact@v4
        with:
          name: macos-app
          path: |
            **/bin/Release/net10.0-maccatalyst/publish/**/*.app
            **/bin/Release/net10.0-maccatalyst/**/*.pkg

注意事项

  • 项目文件名是 zuoleme.csproj
  • 应用 ID 是 com.linweijian.zuoleme
  • 当前使用调试签名,如需发布到应用商店需要配置正式签名
  • 所有构建产物会作为 artifacts 上传,可在 Actions 页面下载

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 20, 2026 03:44
Co-authored-by: Chenfyuan <13745755+Chenfyuan@users.noreply.github.com>
Co-authored-by: Chenfyuan <13745755+Chenfyuan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add GitHub Actions workflow for automated builds Add GitHub Actions workflow for multi-platform builds Jan 20, 2026
Copilot AI requested a review from Chenfyuan January 20, 2026 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants