diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 743dd7a63..6fd3a0168 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -36,17 +36,22 @@ jobs: executable: acecode.exe archive_extension: zip msvc_arch: amd64 + build_desktop: true + cmake_extra_args: -DACECODE_BUILD_DESKTOP=ON - id: macos-x64 os: macos-15 triplet: x64-osx executable: acecode archive_extension: tar.gz - cmake_extra_args: -DCMAKE_OSX_ARCHITECTURES=x86_64 + build_desktop: true + cmake_extra_args: -DCMAKE_OSX_ARCHITECTURES=x86_64 -DACECODE_BUILD_DESKTOP=ON - id: macos-arm64 os: macos-15 triplet: arm64-osx executable: acecode archive_extension: tar.gz + build_desktop: true + cmake_extra_args: -DACECODE_BUILD_DESKTOP=ON steps: - name: Checkout @@ -63,6 +68,23 @@ jobs: - name: Run vcpkg uses: lukka/run-vcpkg@v11 + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + version: '9' + + - name: Build web UI + shell: bash + run: | + cd web + pnpm install --frozen-lockfile + pnpm build + - name: Configure shell: bash run: | @@ -77,6 +99,11 @@ jobs: shell: bash run: cmake --build build --config Release --target acecode + - name: Build desktop + if: matrix.build_desktop + shell: bash + run: cmake --build build --config Release --target acecode-desktop + - name: Extract debug symbols (Linux) if: runner.os == 'Linux' shell: bash @@ -100,6 +127,9 @@ jobs: mkdir -p "$package_dir" cp "build/${{ matrix.executable }}" "$package_dir/" cp README.md README_CN.md "$package_dir/" + if [ "${{ matrix.build_desktop }}" = "true" ] && [ -d "build/ACECode.app" ]; then + cp -r "build/ACECode.app" "$package_dir/" + fi tar -C dist -czf "acecode-${{ matrix.id }}.tar.gz" "acecode-${{ matrix.id }}" - name: Package (Windows) @@ -110,6 +140,9 @@ jobs: New-Item -ItemType Directory -Force -Path $packageDir | Out-Null Copy-Item "build/${{ matrix.executable }}" "$packageDir/" Copy-Item "README.md","README_CN.md" "$packageDir/" + if ("${{ matrix.build_desktop }}" -eq "true" -and (Test-Path "build/Release/acecode-desktop.exe")) { + Copy-Item "build/Release/acecode-desktop.exe" "$packageDir/" + } Compress-Archive -Path "$packageDir/*" -DestinationPath "acecode-${{ matrix.id }}.zip" -Force - name: Upload artifact @@ -127,6 +160,14 @@ jobs: path: build/**/acecode.pdb if-no-files-found: warn + - name: Upload desktop PDB + if: runner.os == 'Windows' && matrix.build_desktop + uses: actions/upload-artifact@v4 + with: + name: acecode-${{ matrix.id }}-desktop-pdb + path: build/**/acecode-desktop.pdb + if-no-files-found: warn + - name: Upload debug symbols (Linux) if: runner.os == 'Linux' uses: actions/upload-artifact@v4 diff --git a/src/desktop/main.cpp b/src/desktop/main.cpp index 46aeda0ca..c820469b3 100644 --- a/src/desktop/main.cpp +++ b/src/desktop/main.cpp @@ -98,6 +98,13 @@ std::string desktop_exe_dir() { return acecode::wide_to_utf8(fs::path(wpath).parent_path().wstring()); } #elif defined(__APPLE__) +bool desktop_webapp_requested(int argc, char** argv) { + for (int i = 1; i < argc; ++i) { + if (argv[i] && is_webapp_arg(argv[i])) return true; + } + return false; +} + std::string desktop_exe_dir() { uint32_t size = 1024; std::vector buf(size);