2
0

build-app.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: 编译客户端
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - '.github/workflows/build-app.yaml'
  7. - 'client/**'
  8. concurrency:
  9. group: "client"
  10. cancel-in-progress: true
  11. permissions:
  12. contents: read
  13. id-token: write
  14. jobs:
  15. build-app:
  16. name: 编译客户端(${{ matrix.os }})
  17. runs-on: ${{ matrix.os }}
  18. env:
  19. HTML_PATH: './client/index.html'
  20. NAME: 'yaa'
  21. ICON: './assets/yaa_512.png'
  22. INSTALLER_LANGUAGE: zh-CN
  23. TARGETS: 'appimage'
  24. strategy:
  25. matrix:
  26. build: [linux, macos, windows]
  27. include:
  28. - build: linux
  29. os: ubuntu-latest
  30. - build: windows
  31. os: windows-latest
  32. - build: macos
  33. os: macos-latest
  34. steps:
  35. - name: 检出仓库
  36. uses: actions/checkout@v4
  37. - name: 安装 Node.js
  38. uses: actions/setup-node@v3
  39. with:
  40. node-version: 18
  41. - name: 为 ubuntu-latest 安装 Rust
  42. if: ${{ matrix.os }} == 'ubuntu-latest'
  43. uses: dtolnay/rust-toolchain@stable
  44. with:
  45. toolchain: stable
  46. target: x86_64-unknown-linux-musl
  47. - name: 为 windows-latest 安装 Rust
  48. if: ${{ matrix.os }} == 'windows-latest'
  49. uses: dtolnay/rust-toolchain@stable
  50. with:
  51. toolchain: stable-x86_64-msvc
  52. target: x86_64-pc-windows-msvc
  53. - name: 为 macos-latest 安装 Rust
  54. if: ${{ matrix.os }} == 'macos-latest'
  55. uses: dtolnay/rust-toolchain@stable
  56. with:
  57. toolchain: stable
  58. target: x86_64-apple-darwin
  59. - name: 安装依赖(仅 Ubuntu 需)
  60. if: ${{ matrix.os }} == 'ubuntu-24.04'
  61. uses: awalsh128/[email protected]
  62. with:
  63. packages: libsoup3.0-dev libdbus-1-dev libjavascriptcoregtk-4.1-dev libwebkit2gtk-4.1-dev build-essential curl wget file libxdo-dev libssl-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev gnome-video-effects gnome-video-effects-extra
  64. version: 1.1
  65. - name: 安装 pake-cli
  66. run: |
  67. npm install pake-cli
  68. - name: 恢复 Rust 缓存
  69. uses: actions/cache/restore@v3
  70. id: cache_store
  71. with:
  72. path: |
  73. ~/.cargo/bin/
  74. ~/.cargo/registry/index/
  75. ~/.cargo/registry/cache/
  76. ~/.cargo/git/db/
  77. node_modules/pake-cli/src-tauri/target/
  78. key: ${{ matrix.os }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}
  79. - name: 安装依赖
  80. run: |
  81. npm install shelljs
  82. npm install axios
  83. - name: 编译客户端
  84. run: |
  85. node ./script/build_with_pake_cli.js
  86. env:
  87. URL: ${{ env.HTML_PATH }}
  88. NAME: ${{ env.NAME }}
  89. ICON: ${{ env.ICON }}
  90. HEIGHT: '780'
  91. WIDTH: '1200'
  92. HIDE_TITLE_BAR: false
  93. FULLSCREEN: false
  94. MULTI_ARCH: false
  95. TARGETS: ${{ env.TARGETS }}
  96. PKG_CONFIG_PATH: /usr/lib/x86_64-linux-gnu/pkgconfig:/usr/share/pkgconfig
  97. PKG_CONFIG_ALLOW_SYSTEM_LIBS: 1
  98. PKG_CONFIG_ALLOW_SYSTEM_CFLAGS: 1
  99. - name: 上传包
  100. uses: actions/upload-artifact@v4
  101. with:
  102. name: output-${{ matrix.os }}.zip
  103. path: node_modules/pake-cli/output/*
  104. retention-days: 3
  105. - name: 保存 Rust 缓存
  106. uses: actions/cache/save@v3
  107. if: steps.cache_store.outputs.cache-hit != 'true'
  108. with:
  109. path: |
  110. ~/.cargo/bin/
  111. ~/.cargo/registry/index/
  112. ~/.cargo/registry/cache/
  113. ~/.cargo/git/db/
  114. node_modules/pake-cli/src-tauri/target/
  115. key: ${{ matrix.os }}-cargo-${{ hashFiles('node_modules/pake-cli/src-tauri/Cargo.lock') }}