更新版本 #127
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 Flatpak Bundle | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| name: Build Flatpak (x86_64) | |
| runs-on: ubuntu-24.04 | |
| container: | |
| image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48 | |
| options: --privileged | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: 添加并更新 Flathub 远程仓库(user 级别) | |
| run: | | |
| flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
| flatpak update --user --assumeyes --noninteractive || true # 更新远程元数据,忽略小错误 | |
| - name: 安装 Node.js 20 SDK 扩展(使用完整 ref 格式,避免 No remote refs) | |
| run: | | |
| flatpak install --user --assumeyes --noninteractive \ | |
| flathub \ | |
| org.freedesktop.Sdk.Extension.node20//25.08 \ | |
| org.electronjs.Electron2.BaseApp//25.08 | |
| - name: 构建 Flatpak 应用 | |
| run: | | |
| flatpak-builder \ | |
| --user \ | |
| --install-deps-from=flathub \ | |
| --force-clean \ | |
| --repo=repo \ | |
| --ccache \ | |
| --default-branch=main \ | |
| --arch=x86_64 \ | |
| --disable-rofiles-fuse \ | |
| build-dir \ | |
| io.github._02engine._02Engine.yml | |
| - name: 生成 .flatpak 单文件 bundle | |
| run: | | |
| flatpak build-bundle \ | |
| repo \ | |
| 02Engine.flatpak \ | |
| io.github._02engine._02Engine \ | |
| main | |
| - name: 上传 Flatpak bundle 作为 artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: 02Engine-flatpak-bundle | |
| path: 02Engine.flatpak | |
| if-no-files-found: error | |
| retention-days: 14 | |
| - name: 上传失败日志(仅在构建失败时) | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-failure-logs | |
| path: | | |
| build-dir/*.log | |
| **/*.log | |
| retention-days: 7 |