-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (59 loc) · 2.44 KB
/
build-windows.yml
File metadata and controls
71 lines (59 loc) · 2.44 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
name: Build Windows Binary
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to build (e.g., v5.3.20)'
required: true
type: string
env:
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
build-windows:
name: Build Windows x64
runs-on: windows-latest
steps:
- name: Checkout code at tag
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Patch Cargo.toml for Windows compatibility
run: |
$content = Get-Content Cargo.toml -Raw
# The home crate v0.5.12 requires unstable edition2024
# Patch Cargo.toml to constrain home version for older tags
if ($content -notmatch 'home\s*=') {
$content = $content -replace '(\[dependencies\])', "`$1`nhome = `">=0.5.4, <0.5.12`" # Pin to avoid v0.5.12 which requires unstable edition2024"
Write-Host "Added home crate constraint to Cargo.toml"
} else {
Write-Host "home crate already specified in Cargo.toml"
}
# Enable bundled feature for rusqlite on Windows to avoid needing sqlite3.lib
# Use literal replacement - regex anchors don't work with CRLF line endings in PowerShell
if ($content -match 'rusqlite\s*=\s*"0\.30"' -and $content -notmatch 'rusqlite.*bundled') {
$content = $content -replace 'rusqlite\s*=\s*"0\.30"', 'rusqlite = { version = "0.30", features = ["bundled"] }'
Write-Host "Enabled bundled feature for rusqlite"
} else {
Write-Host "rusqlite already has features configured or bundled is enabled"
}
Set-Content Cargo.toml $content
Write-Host "Final Cargo.toml dependencies section:"
Get-Content Cargo.toml | Select-String -Pattern "rusqlite|home" -Context 0,0
shell: pwsh
- name: Build release binary
run: cargo build --release --target x86_64-pc-windows-msvc --verbose
- name: Rename binary
run: |
copy target\x86_64-pc-windows-msvc\release\database-replicator.exe database-replicator-windows-x64.exe
shell: cmd
- name: Upload to release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release upload ${{ inputs.tag }} database-replicator-windows-x64.exe --clobber