-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (172 loc) · 6.88 KB
/
Copy pathbuild.yml
File metadata and controls
191 lines (172 loc) · 6.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Build & Release
# Runs when you push a version tag like v0.5.0
on:
push:
tags:
- "v*"
# Allow the workflow to create GitHub Releases
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: windows-latest
target: x86_64-pc-windows-msvc
label: win-x64
- platform: macos-latest
target: aarch64-apple-darwin
label: mac-arm64
- platform: macos-13
target: x86_64-apple-darwin
label: mac-x64
- platform: ubuntu-22.04
target: x86_64-unknown-linux-gnu
label: linux-x64
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v4
# --- System dependencies (Linux only) ---
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libgtk-3-dev \
libsoup-3.0-dev \
libjavascriptcoregtk-4.1-dev
# --- Node.js ---
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install npm dependencies
run: npm ci
# --- Rust ---
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
src-tauri/target
key: ${{ matrix.target }}-cargo-${{ hashFiles('src-tauri/Cargo.lock') }}
restore-keys: |
${{ matrix.target }}-cargo-
# --- Build ---
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: "Video Analytics ${{ github.ref_name }}"
releaseBody: |
## Downloads
**Try it first (no install needed):**
Download the portable zip for your platform, extract, and run.
**Or install:**
Download the installer for a full installation.
| Platform | Portable (no install) | Installer |
|----------|-----------------------|-----------|
| Windows | `*-portable-win-x64.zip` | `*-setup.exe` |
| macOS (Apple Silicon) | `*-portable-mac-arm64.zip` | `.dmg` |
| macOS (Intel) | `*-portable-mac-x64.zip` | `.dmg` |
| Linux | `*-portable-linux-x64.zip` | `.deb` / `.AppImage` |
### Data location
- **Windows**: `%APPDATA%\com.pc-video-analytics.desktop\`
- **macOS**: `~/Library/Application Support/com.pc-video-analytics.desktop/`
- **Linux**: `~/.local/share/com.pc-video-analytics.desktop/`
releaseDraft: true
prerelease: false
args: --target ${{ matrix.target }}
# --- Create portable zip ---
- name: Create portable zip (Windows)
if: matrix.platform == 'windows-latest'
shell: pwsh
run: |
$version = "${{ github.ref_name }}".TrimStart("v")
$exeDir = "src-tauri/target/${{ matrix.target }}/release"
$exe = Get-ChildItem $exeDir -Filter "*.exe" |
Where-Object { $_.Name -notmatch "build-script|xtask" } |
Select-Object -First 1
$outDir = "portable"
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
Copy-Item $exe.FullName (Join-Path $outDir "Video Analytics.exe")
@"
Video Analytics $version - Portable Edition
=============================================
Double-click "Video Analytics.exe" to launch.
Requires Windows 10 (1803+) or Windows 11 with WebView2.
Data stored in: %APPDATA%\com.pc-video-analytics.desktop\
"@ | Out-File (Join-Path $outDir "README.txt") -Encoding UTF8
$zipName = "VideoAnalytics-${version}-portable-${{ matrix.label }}.zip"
Compress-Archive -Path "$outDir/*" -DestinationPath $zipName
echo "PORTABLE_ZIP=$zipName" >> $env:GITHUB_ENV
- name: Create portable zip (macOS)
if: startsWith(matrix.platform, 'macos')
run: |
version="${{ github.ref_name }}"
version="${version#v}"
exe="src-tauri/target/${{ matrix.target }}/release/pc-video-analytics"
if [ ! -f "$exe" ]; then
exe=$(find "src-tauri/target/${{ matrix.target }}/release" -maxdepth 1 -type f -perm +111 ! -name "*.d" ! -name "build-script*" | head -1)
fi
outdir="portable"
mkdir -p "$outdir"
cp "$exe" "$outdir/Video Analytics"
chmod +x "$outdir/Video Analytics"
cat > "$outdir/README.txt" << EOF
Video Analytics $version - Portable Edition
=============================================
Run "./Video Analytics" from Terminal, or double-click.
Requires macOS 10.15+.
Data stored in: ~/Library/Application Support/com.pc-video-analytics.desktop/
EOF
zipname="VideoAnalytics-${version}-portable-${{ matrix.label }}.zip"
cd "$outdir" && zip -r "../$zipname" . && cd ..
echo "PORTABLE_ZIP=$zipname" >> $GITHUB_ENV
- name: Create portable zip (Linux)
if: matrix.platform == 'ubuntu-22.04'
run: |
version="${{ github.ref_name }}"
version="${version#v}"
exe="src-tauri/target/${{ matrix.target }}/release/pc-video-analytics"
if [ ! -f "$exe" ]; then
exe=$(find "src-tauri/target/${{ matrix.target }}/release" -maxdepth 1 -type f -executable ! -name "*.d" ! -name "build-script*" | head -1)
fi
outdir="portable"
mkdir -p "$outdir"
cp "$exe" "$outdir/video-analytics"
chmod +x "$outdir/video-analytics"
cat > "$outdir/README.txt" << EOF
Video Analytics $version - Portable Edition
=============================================
Run: ./video-analytics
Requires: libwebkit2gtk-4.1-0, libgtk-3-0
Data stored in: ~/.local/share/com.pc-video-analytics.desktop/
EOF
zipname="VideoAnalytics-${version}-portable-${{ matrix.label }}.zip"
cd "$outdir" && zip -r "../$zipname" . && cd ..
echo "PORTABLE_ZIP=$zipname" >> $GITHUB_ENV
- name: Upload portable zip to release
if: env.PORTABLE_ZIP != ''
uses: softprops/action-gh-release@v2
with:
files: ${{ env.PORTABLE_ZIP }}
draft: true
tag_name: ${{ github.ref_name }}