feat: add dual release system (offline + online versions) #8
Workflow file for this run
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 & Release Portable Package | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to build (e.g., 5.0.1)' | |
| required: false | |
| default: '' | |
| env: | |
| NODE_VERSION: "22.16.0" | |
| jobs: | |
| build-windows: | |
| name: Build Windows Portable | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup build directory | |
| run: | | |
| mkdir -p dist-windows/node | |
| mkdir -p dist-windows/openclaw-pkg | |
| mkdir -p dist-windows/data | |
| mkdir -p dist-windows/workspace | |
| mkdir -p dist-windows/config | |
| - name: Download Node.js Windows binary | |
| run: | | |
| NODE_URL="https://npmmirror.com/mirrors/node/v${NODE_VERSION}/node-v${NODE_VERSION}-win-x64.zip" | |
| echo "Downloading Node.js from $NODE_URL" | |
| curl -fsSL "$NODE_URL" -o node-win.zip | |
| unzip -q node-win.zip | |
| mv "node-v${NODE_VERSION}-win-x64/"* dist-windows/node/ | |
| rm -rf "node-v${NODE_VERSION}-win-x64" node-win.zip | |
| - name: Setup Node.js (for npm) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install OpenClaw into portable prefix | |
| run: | | |
| npm install -g openclaw \ | |
| --prefix dist-windows/openclaw-pkg \ | |
| --registry https://registry.npmmirror.com | |
| - name: Copy launcher scripts | |
| run: | | |
| cp start.bat dist-windows/ || true | |
| cp stop.bat dist-windows/ || true | |
| cp check.bat dist-windows/ || true | |
| cp start-online.bat dist-windows/ || true | |
| cp start-basic.bat dist-windows/ || true | |
| cp restart.bat dist-windows/ || true | |
| cp config.bat dist-windows/ || true | |
| cp open-config.bat dist-windows/ || true | |
| - name: Copy shell scripts | |
| run: | | |
| cp start.sh dist-windows/ || true | |
| cp stop.sh dist-windows/ || true | |
| cp start-basic.sh dist-windows/ || true | |
| - name: Copy documentation | |
| run: | | |
| cp README.md dist-windows/ || true | |
| cp README_CN.md dist-windows/ || true | |
| cp LICENSE dist-windows/ || true | |
| cp .gitattributes dist-windows/ || true | |
| cp .editorconfig dist-windows/ || true | |
| - name: Get version | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF_NAME}" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Building version: $VERSION" | |
| - name: Package Windows zip | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| mv dist-windows "OpenClaw-Portable-${VERSION}" | |
| zip -r "OpenClaw-Portable-${VERSION}-windows.zip" "OpenClaw-Portable-${VERSION}" | |
| echo "ASSET_NAME=OpenClaw-Portable-${VERSION}-windows.zip" >> $GITHUB_ENV | |
| ls -lh *.zip | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ env.ASSET_NAME }} | |
| generate_release_notes: true | |
| body: | | |
| ## OpenClaw Portable ${{ steps.version.outputs.version }} | |
| ### 下载 | |
| - **Windows**: ${{ env.ASSET_NAME }} | |
| ### 系统要求 | |
| - Windows 10 2004+ / Windows 11 | |
| - 至少 1GB 可用空间 | |
| - 首次运行需要网络(~60MB) | |
| ### 快速开始 | |
| 1. 解压到 U盘 | |
| 2. 双击 `start-online.bat`(首次需联网) | |
| 3. 访问 http://localhost:18789 | |
| ### 更新日志 | |
| 查看 [Commits](https://github.com/${{ github.repository }}/commits/${{ github.sha }}) | |
| - name: Upload artifact (for manual dispatch) | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-portable | |
| path: "*.zip" | |
| build-linux: | |
| name: Build Linux Portable | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup build directory | |
| run: | | |
| mkdir -p dist-linux/node | |
| mkdir -p dist-linux/openclaw-pkg | |
| mkdir -p dist-linux/data | |
| mkdir -p dist-linux/workspace | |
| mkdir -p dist-linux/config | |
| - name: Download Node.js Linux binary | |
| run: | | |
| NODE_URL="https://npmmirror.com/mirrors/node/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz" | |
| echo "Downloading Node.js from $NODE_URL" | |
| curl -fsSL "$NODE_URL" -o node-linux.tar.gz | |
| tar -xzf node-linux.tar.gz | |
| mv "node-v${NODE_VERSION}-linux-x64/"* dist-linux/node/ | |
| rm -rf "node-v${NODE_VERSION}-linux-x64" node-linux.tar.gz | |
| - name: Setup Node.js (for npm) | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install OpenClaw into portable prefix | |
| run: | | |
| npm install -g openclaw \ | |
| --prefix dist-linux/openclaw-pkg \ | |
| --registry https://registry.npmmirror.com | |
| - name: Copy shell scripts | |
| run: | | |
| cp start.sh dist-linux/ || true | |
| cp stop.sh dist-linux/ || true | |
| cp start-basic.sh dist-linux/ || true | |
| cp install.sh dist-linux/ || true | |
| chmod +x dist-linux/*.sh | |
| - name: Copy documentation | |
| run: | | |
| cp README.md dist-linux/ || true | |
| cp README_CN.md dist-linux/ || true | |
| cp LICENSE dist-linux/ || true | |
| cp .gitattributes dist-linux/ || true | |
| cp .editorconfig dist-linux/ || true | |
| - name: Get version | |
| id: version | |
| run: | | |
| if [ -n "${{ github.event.inputs.version }}" ]; then | |
| VERSION="${{ github.event.inputs.version }}" | |
| else | |
| VERSION="${GITHUB_REF_NAME}" | |
| fi | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Package Linux tarball | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| mv dist-linux "OpenClaw-Portable-${VERSION}" | |
| tar -czf "OpenClaw-Portable-${VERSION}-linux-x64.tar.gz" "OpenClaw-Portable-${VERSION}" | |
| echo "ASSET_NAME=OpenClaw-Portable-${VERSION}-linux-x64.tar.gz" >> $GITHUB_ENV | |
| ls -lh *.tar.gz | |
| - name: Create GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: ${{ env.ASSET_NAME }} | |
| - name: Upload artifact (for manual dispatch) | |
| if: github.event_name == 'workflow_dispatch' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-portable | |
| path: "*.tar.gz" |