mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
- 移除对 'open' 包的依赖,改用 Node.js 内置模块实现自动打开浏览器 - 新增 openUrl 函数,支持 macOS、Windows 和 Linux 系统 - 更新网络接口遍历逻辑中的变量命名以提高可读性 - 静态资源处理中间件改为使用 Bun.file API 并内嵌到可执行文件中 - 优化控制台输出信息,增强用户体验和提示清晰度 - 调整服务器监听地址为 0.0.0.0,并移除 trust proxy 设置 - 修改获取局域网 IP 的函数名称和注释结构使其更加明确 - 删除 package.json 和 lock 文件中不再使用的依赖项及相关条目 - 更新 GitHub Actions 工作流配置以适配新的编译和打包方式 - 在 CI 流程中启用代码压缩选项以减小最终二进制文件体积
79 lines
2.0 KiB
YAML
79 lines
2.0 KiB
YAML
name: 构建多平台可执行程序
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
name: Build for ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- os: windows-latest
|
|
executable: ogame-windows.exe
|
|
- os: ubuntu-latest
|
|
executable: ogame-linux
|
|
- os: macos-latest
|
|
executable: ogame-macos
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
# 获取 package.json 中的版本号
|
|
- name: Get version
|
|
id: get_version
|
|
shell: bash
|
|
run: |
|
|
VERSION=$(node -p "require('./package.json').version")
|
|
echo "VERSION=v$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Install Dependencies
|
|
run: bun install
|
|
|
|
# 构建前端 Vue 项目
|
|
- name: Build Vue Frontend
|
|
run: bun run build
|
|
|
|
# 编译单文件二进制程序
|
|
- name: Compile Single Executable
|
|
run: |
|
|
bun build ./server.js --compile --minify --outfile ${{ matrix.executable }}
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.executable }}
|
|
path: ${{ matrix.executable }}
|
|
|
|
outputs:
|
|
app_version: ${{ steps.get_version.outputs.VERSION }}
|
|
|
|
release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ needs.build.outputs.app_version }}
|
|
name: Release ${{ needs.build.outputs.app_version }}
|
|
files: |
|
|
ogame-windows.exe/ogame-windows.exe
|
|
ogame-linux/ogame-linux
|
|
ogame-macos/ogame-macos
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |