This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 测试构建发布 | |
| name: build-nightly-app | |
| on: | |
| push: | |
| branches: | |
| - nightly | |
| jobs: | |
| # ========================= 准备项目 ========================= | |
| init: | |
| name: 初始化构建 | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.step_init.outputs.VERSION }} | |
| steps: | |
| # 拉取代码 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # 初始化一些流程需要的环境变量 | |
| - name: Init Env | |
| id: step_init | |
| run: echo VERSION=$(node -p "require('./package.json').version") >> $GITHUB_OUTPUT | |
| # ========================= 构建 Tauri 版本 ========================= | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| needs: init | |
| strategy: | |
| matrix: | |
| os: [windows-2022, ubuntu-22.04] | |
| steps: | |
| - name: 安装构建依赖 | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libglib2.0-dev \ | |
| libgtk-3-dev \ | |
| pkg-config \ | |
| xdg-utils \ | |
| build-essential \ | |
| librsvg2-dev \ | |
| libwebkit2gtk-4.0-dev \ | |
| libwebkit2gtk-4.1-dev \ | |
| libjavascriptcoregtk-4.0-dev \ | |
| libayatana-appindicator3-dev | |
| - name: 拉取代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: 设置 Nodejs | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| # 更新依赖 | |
| - name: 更新依赖 | |
| run: yarn | |
| - name: 设置 Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| profile: minimal | |
| override: true | |
| - name: 检查 Tauri 环境 | |
| run: yarn tauri info | |
| - name: 构建 Tauri 应用 | |
| if: matrix.os == 'windows-2022' | |
| run: yarn build:tauri -t x86_64-pc-windows-msvc -b nsis | |
| - name: 构建 Tauri 应用 | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: yarn build:tauri -t x86_64-unknown-linux-gnu -b deb | |
| - name: 准备产物目录 | |
| if: matrix.os != 'windows-2022' | |
| run: | | |
| mkdir -p upload | |
| cp src/tauri/target/*/release/bundle/deb/*.deb upload/ || true | |
| - name: 准备产物目录 | |
| if: matrix.os == 'windows-2022' | |
| shell: pwsh | |
| run: | | |
| New-Item -ItemType Directory -Path upload -Force | |
| $files = Get-ChildItem -Path "src/tauri/target/*/release/bundle/nsis/" -Filter *.exe -Recurse | |
| foreach ($file in $files) { | |
| Copy-Item -Path $file.FullName -Destination "upload/" | |
| } | |
| - name: 上传构建产物 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ needs.init.outputs.version }}-${{ matrix.os }} | |
| path: upload/ |