|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + tag: |
| 10 | + description: 'Tag to publish (e.g. v2.1.0). Leave empty to use the most recent tag.' |
| 11 | + required: false |
| 12 | + default: '' |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + |
| 17 | +jobs: |
| 18 | + portable-windows: |
| 19 | + name: Portable Windows zip |
| 20 | + runs-on: windows-latest |
| 21 | + steps: |
| 22 | + - uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Read OpenClaw version |
| 25 | + id: openclaw_version |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + version=$(tr -d '[:space:]' < OPENCLAW_VERSION) |
| 29 | + echo "version=$version" >> "$GITHUB_OUTPUT" |
| 30 | +
|
| 31 | + - uses: actions/setup-node@v4 |
| 32 | + with: |
| 33 | + node-version: '22' |
| 34 | + |
| 35 | + - name: Run portable setup (Windows) |
| 36 | + shell: cmd |
| 37 | + run: | |
| 38 | + cd portable |
| 39 | + call setup.bat |
| 40 | +
|
| 41 | + - name: Stage portable folder |
| 42 | + shell: bash |
| 43 | + run: | |
| 44 | + mkdir -p dist |
| 45 | + tag_name="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}" |
| 46 | + stage_dir="dist/u-claw-portable-windows-${tag_name}" |
| 47 | + mkdir -p "$stage_dir" |
| 48 | + cp -R portable/. "$stage_dir/" |
| 49 | + # Drop dev-only large files we don't ship |
| 50 | + rm -rf "$stage_dir/data/logs" 2>/dev/null || true |
| 51 | +
|
| 52 | + - name: Zip portable |
| 53 | + shell: pwsh |
| 54 | + run: | |
| 55 | + $tag = if ($env:GITHUB_REF_NAME) { $env:GITHUB_REF_NAME } else { '${{ github.event.inputs.tag }}' } |
| 56 | + $stage = "dist/u-claw-portable-windows-$tag" |
| 57 | + $out = "dist/u-claw-portable-windows-$tag.zip" |
| 58 | + Compress-Archive -Path "$stage/*" -DestinationPath $out -CompressionLevel Optimal |
| 59 | +
|
| 60 | + - uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: portable-windows |
| 63 | + path: dist/u-claw-portable-windows-*.zip |
| 64 | + |
| 65 | + portable-mac: |
| 66 | + name: Portable macOS zip |
| 67 | + runs-on: macos-14 |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v4 |
| 70 | + |
| 71 | + - uses: actions/setup-node@v4 |
| 72 | + with: |
| 73 | + node-version: '22' |
| 74 | + |
| 75 | + - name: Run portable setup (mac) |
| 76 | + run: | |
| 77 | + cd portable |
| 78 | + bash setup.sh |
| 79 | +
|
| 80 | + - name: Stage portable folder |
| 81 | + run: | |
| 82 | + mkdir -p dist |
| 83 | + tag_name="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}" |
| 84 | + stage_dir="dist/u-claw-portable-mac-${tag_name}" |
| 85 | + mkdir -p "$stage_dir" |
| 86 | + cp -R portable/. "$stage_dir/" |
| 87 | + rm -rf "$stage_dir/data/logs" 2>/dev/null || true |
| 88 | +
|
| 89 | + - name: Zip portable |
| 90 | + run: | |
| 91 | + tag_name="${GITHUB_REF_NAME:-${{ github.event.inputs.tag }}}" |
| 92 | + cd dist |
| 93 | + zip -qry "u-claw-portable-mac-${tag_name}.zip" "u-claw-portable-mac-${tag_name}" |
| 94 | +
|
| 95 | + - uses: actions/upload-artifact@v4 |
| 96 | + with: |
| 97 | + name: portable-mac |
| 98 | + path: dist/u-claw-portable-mac-*.zip |
| 99 | + |
| 100 | + desktop-windows: |
| 101 | + name: Electron Windows installer |
| 102 | + runs-on: windows-latest |
| 103 | + steps: |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + |
| 106 | + - uses: actions/setup-node@v4 |
| 107 | + with: |
| 108 | + node-version: '22' |
| 109 | + |
| 110 | + - name: Install dependencies |
| 111 | + shell: cmd |
| 112 | + run: | |
| 113 | + cd u-claw-app |
| 114 | + npm install --registry=https://registry.npmmirror.com |
| 115 | +
|
| 116 | + - name: Build Windows installer |
| 117 | + shell: cmd |
| 118 | + run: | |
| 119 | + cd u-claw-app |
| 120 | + npm run build:win |
| 121 | + env: |
| 122 | + # Skip code signing — we ship unsigned. README documents the SmartScreen workaround. |
| 123 | + CSC_IDENTITY_AUTO_DISCOVERY: 'false' |
| 124 | + |
| 125 | + - uses: actions/upload-artifact@v4 |
| 126 | + with: |
| 127 | + name: desktop-windows |
| 128 | + path: | |
| 129 | + u-claw-app/release/*.exe |
| 130 | + u-claw-app/release/*.exe.blockmap |
| 131 | +
|
| 132 | + desktop-mac: |
| 133 | + name: Electron macOS DMG |
| 134 | + runs-on: macos-14 |
| 135 | + steps: |
| 136 | + - uses: actions/checkout@v4 |
| 137 | + |
| 138 | + - uses: actions/setup-node@v4 |
| 139 | + with: |
| 140 | + node-version: '22' |
| 141 | + |
| 142 | + - name: Install dependencies |
| 143 | + run: | |
| 144 | + cd u-claw-app |
| 145 | + npm install --registry=https://registry.npmmirror.com |
| 146 | +
|
| 147 | + - name: Build macOS DMG |
| 148 | + run: | |
| 149 | + cd u-claw-app |
| 150 | + npm run build:mac-arm64 |
| 151 | + env: |
| 152 | + CSC_IDENTITY_AUTO_DISCOVERY: 'false' |
| 153 | + |
| 154 | + - uses: actions/upload-artifact@v4 |
| 155 | + with: |
| 156 | + name: desktop-mac |
| 157 | + path: | |
| 158 | + u-claw-app/release/*.dmg |
| 159 | + u-claw-app/release/*.dmg.blockmap |
| 160 | +
|
| 161 | + publish: |
| 162 | + name: Publish GitHub Release |
| 163 | + needs: [portable-windows, portable-mac, desktop-windows, desktop-mac] |
| 164 | + runs-on: ubuntu-latest |
| 165 | + steps: |
| 166 | + - uses: actions/checkout@v4 |
| 167 | + |
| 168 | + - uses: actions/download-artifact@v4 |
| 169 | + with: |
| 170 | + path: artifacts |
| 171 | + |
| 172 | + - name: Resolve tag |
| 173 | + id: tag |
| 174 | + run: | |
| 175 | + if [ -n "${{ github.event.inputs.tag }}" ]; then |
| 176 | + tag="${{ github.event.inputs.tag }}" |
| 177 | + else |
| 178 | + tag="${GITHUB_REF_NAME}" |
| 179 | + fi |
| 180 | + echo "tag=$tag" >> "$GITHUB_OUTPUT" |
| 181 | +
|
| 182 | + - name: Read OpenClaw version |
| 183 | + id: openclaw_version |
| 184 | + run: | |
| 185 | + version=$(tr -d '[:space:]' < OPENCLAW_VERSION) |
| 186 | + echo "version=$version" >> "$GITHUB_OUTPUT" |
| 187 | +
|
| 188 | + - name: Create or update release |
| 189 | + uses: softprops/action-gh-release@v2 |
| 190 | + with: |
| 191 | + tag_name: ${{ steps.tag.outputs.tag }} |
| 192 | + name: U-Claw ${{ steps.tag.outputs.tag }} |
| 193 | + body: | |
| 194 | + ## U-Claw ${{ steps.tag.outputs.tag }} |
| 195 | +
|
| 196 | + - 内置虾盘云:首次启动自动绑定本机/U盘指纹,生成 `sk-...` apiKey |
| 197 | + - OpenClaw runtime: `${{ steps.openclaw_version.outputs.version }}` |
| 198 | + - 充值入口:https://u-claw.org/cloud.html |
| 199 | +
|
| 200 | + > Windows 安装包未做代码签名,首次运行需在 SmartScreen 选择"仍要运行"。 |
| 201 | + > macOS DMG 未做公证,首次启动需 `xattr -rd com.apple.quarantine /Applications/U-Claw.app` 或右键打开。 |
| 202 | + files: | |
| 203 | + artifacts/portable-windows/* |
| 204 | + artifacts/portable-mac/* |
| 205 | + artifacts/desktop-windows/* |
| 206 | + artifacts/desktop-mac/* |
| 207 | + fail_on_unmatched_files: false |
| 208 | + env: |
| 209 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments