Skip to content

Add Windows portable ZIP packaging#31

Open
hmtdpetn wants to merge 1 commit into
black-ant:masterfrom
hmtdpetn:feat/windows-portable-package
Open

Add Windows portable ZIP packaging#31
hmtdpetn wants to merge 1 commit into
black-ant:masterfrom
hmtdpetn:feat/windows-portable-package

Conversation

@hmtdpetn

@hmtdpetn hmtdpetn commented Jun 10, 2026

Copy link
Copy Markdown

中文说明

为什么做这个改动

我注意到项目当前的 Windows 发布流程主要生成 NSIS 格式的 .exe 安装程序。

安装方式本身很好,不过在一些使用场景下,直接下载 ZIP、解压后运行可能会更加方便,例如免安装使用、放在移动硬盘中运行,或者保留多份彼此独立的程序目录。

目前官方发布流程中还没有直接生成完整便携 ZIP 的选项,所以我在现有 Windows 发布脚本的基础上补充了这一种输出方式。

如果作者觉得这个方案合适,后续发布时可以按实际需要选择生成安装程序、便携 ZIP,或者同时生成两种产物,或许能让后续发布和使用更加方便。

主要改动

本次修改扩展了现有的:

bat/publish.ps1

增加了三种 Windows 输出格式:

INSTALLER
PORTABLE
BOTH

只生成原有的 NSIS 安装程序:

powershell -File bat/publish.ps1 -Target WINDOWS -WindowsFormat INSTALLER

只生成便携 ZIP:

powershell -File bat/publish.ps1 -Target WINDOWS -WindowsFormat PORTABLE

同时生成安装程序和便携 ZIP:

powershell -File bat/publish.ps1 -Target WINDOWS -WindowsFormat BOTH

不填写 -WindowsFormat 时,默认仍然是 INSTALLER,不会改变原来的发布方式。

便携包内容

生成的文件路径为:

publish/output/AntBrowser-{version}-windows-amd64-portable.zip

压缩包中包含运行所需的主要文件:

AntBrowser-{version}-windows-amd64-portable/
├─ ant-chrome.exe
├─ config.yaml
├─ bin/
│  ├─ xray.exe
│  └─ sing-box.exe
├─ chrome/
└─ data/

便携 ZIP 直接复用原有的 Windows staging 流程,因此安装包和便携包使用相同的主程序、初始配置、Xray 和 sing-box 运行时,以及浏览器内核处理逻辑。

压缩包不会包含用户数据库、浏览器实例、代理订阅或其他个人数据。

PORTABLE 模式不需要 NSIS;BOTH 模式只构建一次程序并准备一次 staging。

验证情况

已经完成以下验证:

  • PowerShell 脚本语法检查通过;
  • Windows 主程序构建成功;
  • 便携 ZIP 成功生成并解压;
  • ant-chrome.exexray.exesing-box.exe 均正确包含;
  • config.yaml 与官方初始配置模板一致;
  • ZIP 中没有用户数据库、个人配置、源码或其他平台的运行时;
  • 将 ZIP 移动到桌面并独立解压后,ant-chrome.exe 可以正常启动;
  • 程序运行不依赖原来的源码目录;
  • 测试产物已经清理,没有提交到仓库。

English Description

Motivation

I noticed that the current Windows publishing flow mainly produces an NSIS .exe installer.

The installer itself works well, but in some situations a ZIP archive that can be extracted and run directly may be more convenient, for example for no-install usage, removable drives, or keeping multiple independent application directories.

The current upstream publishing flow does not provide an option to generate a complete portable ZIP directly, so this PR adds that output option to the existing Windows publishing script.

If the maintainer finds the approach useful, future releases can choose to generate the installer, the portable ZIP, or both, depending on the release needs.

Changes

This PR extends the existing:

bat/publish.ps1

script with three Windows output formats:

INSTALLER
PORTABLE
BOTH

Generate only the existing NSIS installer:

powershell -File bat/publish.ps1 -Target WINDOWS -WindowsFormat INSTALLER

Generate only the portable ZIP:

powershell -File bat/publish.ps1 -Target WINDOWS -WindowsFormat PORTABLE

Generate both outputs:

powershell -File bat/publish.ps1 -Target WINDOWS -WindowsFormat BOTH

When -WindowsFormat is omitted, the default remains INSTALLER, preserving the existing publishing behavior.

Portable package contents

The archive is written to:

publish/output/AntBrowser-{version}-windows-amd64-portable.zip

It contains the main runtime files:

AntBrowser-{version}-windows-amd64-portable/
├─ ant-chrome.exe
├─ config.yaml
├─ bin/
│  ├─ xray.exe
│  └─ sing-box.exe
├─ chrome/
└─ data/

The portable ZIP reuses the existing Windows staging flow, so the installer and portable package use the same application executable, initial configuration, Xray and sing-box runtimes, and browser runtime handling logic.

The archive does not include user databases, browser profiles, proxy subscriptions, or other personal data.

PORTABLE mode does not require NSIS. BOTH mode builds the application and prepares staging only once.

Verification

The following checks were completed:

  • PowerShell syntax validation passed;
  • the Windows application was built successfully;
  • the portable ZIP was generated and extracted successfully;
  • ant-chrome.exe, xray.exe, and sing-box.exe were included correctly;
  • the packaged config.yaml matched the official initial configuration template;
  • no user databases, personal configuration, source files, or wrong-platform runtimes were included;
  • the ZIP was moved to the desktop and extracted independently of the source tree;
  • ant-chrome.exe launched successfully from the extracted directory;
  • the application did not depend on the original source directory;
  • all generated test artifacts were removed and were not committed.

@hmtdpetn hmtdpetn force-pushed the feat/windows-portable-package branch from 8bf03d0 to 9acbbed Compare June 10, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant