Skip to content

Commit 22657a8

Browse files
committed
feat(installer): suporta install.cat em linux/macos/windows e ativa artefatos multiplataforma
Reestrutura install.sh com fluxo dedicado para Linux e macOS, validação de asset da release e mensagens de erro mais claras. Adiciona install.ps1 para Windows seguindo formato do install.cat, com download da latest release, extração em %LOCALAPPDATA% e inclusão no PATH de usuário. Ativa jobs de macOS e Windows no workflow de release, corrige compilação do CLI para packages/crossbar_cli e inclui artefatos no create-release. Também remove pipe com tail no build do tray daemon para não mascarar falhas de compilação e atualiza README com instruções de instalação multiplataforma.
1 parent 70affab commit 22657a8

File tree

5 files changed

+249
-76
lines changed

5 files changed

+249
-76
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ jobs:
5252
retention-days: 7
5353

5454
build-macos:
55-
if: false # Temporarily disabled
5655
runs-on: macos-latest
5756
steps:
5857
- uses: actions/checkout@v4
@@ -73,16 +72,19 @@ jobs:
7372
${{ runner.os }}-pub-cache-
7473
7574
- name: Get dependencies
76-
run: flutter pub get
75+
run: |
76+
flutter pub get
77+
cd packages/crossbar_cli
78+
dart pub get
7779
7880
- name: Build macOS GUI
7981
run: flutter build macos --release
8082

8183
- name: Setup unified binaries
8284
run: |
83-
cd build/macos/Build/Products/Release/crossbar.app/Contents/MacOS
84-
mv crossbar crossbar-gui
85-
dart compile exe $GITHUB_WORKSPACE/bin/crossbar.dart -o crossbar
85+
mv build/macos/Build/Products/Release/crossbar.app/Contents/MacOS/crossbar build/macos/Build/Products/Release/crossbar.app/Contents/MacOS/crossbar-gui
86+
cd packages/crossbar_cli
87+
dart compile exe bin/crossbar.dart -o ../../build/macos/Build/Products/Release/crossbar.app/Contents/MacOS/crossbar
8688
8789
- name: Compress artifact
8890
run: |
@@ -97,7 +99,6 @@ jobs:
9799
retention-days: 7
98100

99101
build-windows:
100-
if: false # Temporarily disabled
101102
runs-on: windows-latest
102103
steps:
103104
- uses: actions/checkout@v4
@@ -118,7 +119,10 @@ jobs:
118119
${{ runner.os }}-pub-cache-
119120
120121
- name: Get dependencies
121-
run: flutter pub get
122+
run: |
123+
flutter pub get
124+
cd packages/crossbar_cli
125+
dart pub get
122126
123127
- name: Build Windows GUI
124128
run: flutter build windows --release
@@ -127,7 +131,7 @@ jobs:
127131
shell: pwsh
128132
run: |
129133
Rename-Item -Path "build/windows/x64/runner/Release/crossbar.exe" -NewName "crossbar-gui.exe"
130-
dart compile exe bin/crossbar.dart -o build/windows/x64/runner/Release/crossbar.exe
134+
dart compile exe packages/crossbar_cli/bin/crossbar.dart -o build/windows/x64/runner/Release/crossbar.exe
131135
132136
- name: Compress artifact
133137
shell: pwsh
@@ -205,7 +209,7 @@ jobs:
205209
retention-days: 7
206210

207211
create-release:
208-
needs: [build-linux, build-android]
212+
needs: [build-linux, build-macos, build-windows, build-android]
209213
runs-on: ubuntu-latest
210214
permissions:
211215
contents: write
@@ -225,6 +229,8 @@ jobs:
225229
with:
226230
files: |
227231
artifacts/crossbar-linux/crossbar-linux-x64.tar.gz
232+
artifacts/crossbar-macos/crossbar-macos-arm64.tar.gz
233+
artifacts/crossbar-windows/crossbar-windows-x64.zip
228234
artifacts/crossbar-android/crossbar-android-arm64.apk
229235
generate_release_notes: true
230236
draft: false

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ linux: ## Build for Linux (Flutter GUI + CLI + Tray Daemon)
6565
@echo "Compiling unified CLI from packages/crossbar_cli..."
6666
cd packages/crossbar_cli && dart compile exe bin/crossbar.dart -o ../../$(LINUX_BUNDLE)/crossbar
6767
@echo "Compiling tray daemon for multi-icon support..."
68-
dart build cli --target=bin/crossbar_tray_daemon.dart --output=build/tray_daemon_tmp 2>&1 | tail -1
68+
dart build cli --target=bin/crossbar_tray_daemon.dart --output=build/tray_daemon_tmp
6969
cp build/tray_daemon_tmp/bundle/bin/crossbar_tray_daemon $(LINUX_BUNDLE)/crossbar_tray_daemon
7070
rm -rf build/tray_daemon_tmp
7171
@echo "Copying desktop integration files..."

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,31 @@ print(json.dumps({
7171

7272
### Installation
7373

74-
#### 1. One-Line Install (Linux)
74+
#### 1. One-Line Install
75+
76+
**Linux / macOS:**
7577

7678
```bash
7779
curl -fsSL https://install.cat/verseles/crossbar | sh
7880
```
7981

80-
This installs Crossbar to `~/.local/share/crossbar` with a symlink at `~/.local/bin/crossbar`. A `.desktop` entry is created automatically so you can find it in your app menu.
82+
**Windows (PowerShell):**
83+
84+
```powershell
85+
irm https://install.cat/verseles/crossbar?format=ps1 | iex
86+
```
87+
88+
On Linux this installs Crossbar to `~/.local/share/crossbar` with a symlink at `~/.local/bin/crossbar`.
89+
On macOS this installs `Crossbar.app` to `~/Applications/Crossbar.app` and creates `~/.local/bin/crossbar`.
90+
On Windows this installs Crossbar to `%LOCALAPPDATA%\Crossbar` and adds this path to user `PATH`.
8191

8292
#### 2. Download Pre-built Binaries
8393

8494
Download the latest release from [GitHub Releases](https://github.com/verseles/crossbar/releases):
8595

8696
- **Linux**: `crossbar-linux-x64.tar.gz`
97+
- **macOS**: `crossbar-macos-arm64.tar.gz`
98+
- **Windows**: `crossbar-windows-x64.zip`
8799
- **Android**: `crossbar-android-arm64.apk`
88100

89101
**Linux manual install:**
@@ -94,6 +106,22 @@ tar -xzf crossbar-linux-x64.tar.gz -C ~/.local/share/crossbar
94106
ln -sf ~/.local/share/crossbar/crossbar ~/.local/bin/crossbar
95107
```
96108

109+
**macOS manual install:**
110+
111+
```bash
112+
mkdir -p ~/Applications
113+
tar -xzf crossbar-macos-arm64.tar.gz -C /tmp
114+
mv /tmp/crossbar.app ~/Applications/Crossbar.app
115+
ln -sf ~/Applications/Crossbar.app/Contents/MacOS/crossbar ~/.local/bin/crossbar
116+
```
117+
118+
**Windows manual install (PowerShell):**
119+
120+
```powershell
121+
Expand-Archive .\crossbar-windows-x64.zip -DestinationPath "$env:LOCALAPPDATA\Crossbar" -Force
122+
[Environment]::SetEnvironmentVariable("Path", "$([Environment]::GetEnvironmentVariable('Path','User'));$env:LOCALAPPDATA\Crossbar", "User")
123+
```
124+
97125
**Usage:**
98126

99127
```bash

install.ps1

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Crossbar installer (Windows) - https://github.com/verseles/crossbar
2+
# Usage: irm https://install.cat/verseles/crossbar?format=ps1 | iex
3+
4+
Set-StrictMode -Version Latest
5+
$ErrorActionPreference = "Stop"
6+
7+
$Repo = "verseles/crossbar"
8+
$InstallDir = Join-Path $env:LOCALAPPDATA "Crossbar"
9+
$BinPath = Join-Path $InstallDir "crossbar.exe"
10+
11+
function Write-Info([string]$Message) {
12+
Write-Host ":: $Message" -ForegroundColor Cyan
13+
}
14+
15+
function Write-Ok([string]$Message) {
16+
Write-Host ":: $Message" -ForegroundColor Green
17+
}
18+
19+
function Get-Arch {
20+
$arch = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString()
21+
switch ($arch) {
22+
"X64" { return "x64" }
23+
"Arm64" { return "arm64" }
24+
default { throw "Unsupported Windows architecture: $arch" }
25+
}
26+
}
27+
28+
function Add-UserPath([string]$PathEntry) {
29+
$current = [Environment]::GetEnvironmentVariable("Path", "User")
30+
$parts = @()
31+
if ($current) {
32+
$parts = $current.Split(";") | Where-Object { $_ -and $_.Trim() -ne "" }
33+
}
34+
35+
if ($parts -contains $PathEntry) {
36+
return $false
37+
}
38+
39+
$newPath = if ($parts.Count -eq 0) { $PathEntry } else { ($parts + $PathEntry) -join ";" }
40+
[Environment]::SetEnvironmentVariable("Path", $newPath, "User")
41+
return $true
42+
}
43+
44+
Write-Info "Crossbar Installer (Windows)"
45+
46+
$arch = Get-Arch
47+
Write-Info "Detected: windows ($arch)"
48+
49+
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$Repo/releases/latest" -Headers @{ "User-Agent" = "crossbar-install" }
50+
$version = $release.tag_name
51+
if (-not $version) {
52+
throw "Could not determine latest version."
53+
}
54+
55+
$assetName = "crossbar-windows-$arch.zip"
56+
$asset = $release.assets | Where-Object { $_.name -eq $assetName } | Select-Object -First 1
57+
if (-not $asset) {
58+
$available = ($release.assets | Where-Object { $_.name -like "crossbar-*" } | ForEach-Object { $_.name }) -join ", "
59+
throw "Asset '$assetName' not found in release $version. Available: $available"
60+
}
61+
62+
$tempRoot = Join-Path $env:TEMP ("crossbar-install-" + [Guid]::NewGuid().ToString("N"))
63+
$zipPath = Join-Path $tempRoot $assetName
64+
65+
try {
66+
New-Item -ItemType Directory -Path $tempRoot -Force | Out-Null
67+
68+
Write-Info "Downloading $assetName..."
69+
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $zipPath
70+
71+
if (Test-Path $InstallDir) {
72+
Remove-Item -Path $InstallDir -Recurse -Force
73+
}
74+
New-Item -ItemType Directory -Path $InstallDir -Force | Out-Null
75+
76+
Write-Info "Extracting..."
77+
Expand-Archive -Path $zipPath -DestinationPath $InstallDir -Force
78+
79+
if (-not (Test-Path $BinPath)) {
80+
throw "Installation failed: '$BinPath' not found after extraction."
81+
}
82+
83+
$pathUpdated = Add-UserPath -PathEntry $InstallDir
84+
if ($pathUpdated) {
85+
Write-Info "Added '$InstallDir' to user PATH. Restart terminal to apply."
86+
}
87+
88+
Write-Ok "Crossbar $version installed successfully."
89+
Write-Host ""
90+
Write-Host "Run 'crossbar --help' in a new terminal."
91+
Write-Host "GUI: execute '$BinPath' or create a shortcut for it."
92+
}
93+
finally {
94+
if (Test-Path $tempRoot) {
95+
Remove-Item -Path $tempRoot -Recurse -Force -ErrorAction SilentlyContinue
96+
}
97+
}

0 commit comments

Comments
 (0)