From cc44561f6a8659d2b81cc67522da58b12699b65a Mon Sep 17 00:00:00 2001
From: jzeuzs <75403863+jzeuzs@users.noreply.github.com>
Date: Sat, 27 Sep 2025 21:03:06 +0800
Subject: [PATCH 1/2] Add windows `.msi` installers
---
.github/workflows/release.yml | 30 +++++
Cargo.lock | 10 ++
Cargo.toml | 3 +
build.rs | 9 ++
railway.exe.manifest | 32 +++++
wix/License.rtf | Bin 0 -> 1255 bytes
wix/logo.ico | Bin 0 -> 4286 bytes
wix/main.wxs | 214 ++++++++++++++++++++++++++++++++++
8 files changed, 298 insertions(+)
create mode 100644 railway.exe.manifest
create mode 100644 wix/License.rtf
create mode 100644 wix/logo.ico
create mode 100644 wix/main.wxs
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 31bbda59e..849654ac6 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -80,12 +80,15 @@ jobs:
- target: x86_64-pc-windows-msvc
os: windows-latest
+ rustflags: -C target-feature=+crt-static
- target: i686-pc-windows-msvc
os: windows-latest
+ rustflags: -C target-feature=+crt-static
- target: x86_64-pc-windows-gnu
os: windows-latest
+ rustflags: -C target-feature=+crt-static
- target: aarch64-pc-windows-msvc
os: windows-latest
@@ -94,23 +97,41 @@ jobs:
- target: i686-pc-windows-gnu
os: ubuntu-latest
use-cross: true
+ rustflags: -C target-feature=+crt-static
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
+
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
+ - name: Setup cargo-wix
+ continue-on-error: true
+ if: matrix.os == 'windows-latest'
+ run: cargo install cargo-wix
+ env:
+ # cargo-wix does not require static crt
+ RUSTFLAGS: ""
+
- name: Build release binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.use-cross || matrix.os == 'ubuntu-latest' }}
+
+ - name: Build windows installer
+ continue-on-error: true
+ if: matrix.os == 'windows.latest'
+ run: >
+ cargo wix -v --nocapture
+ --target ${{ matrix.target }}
+ --output railway-${{ needs.create-release.outputs.railway_version }}-${{ matrix.target }}.msi
- name: Upload docker artifact
if: ${{ matrix.docker-artifact }}
@@ -163,6 +184,15 @@ jobs:
run: |
gh release upload "${{ needs.create-release.outputs.railway_version }}" railway-${{ needs.create-release.outputs.railway_version }}-${{ matrix.target }}*
+ - name: Upload windows installers
+ if: matrix.os == 'windows-latest'
+ continue-on-error: true
+ env:
+ GH_TOKEN: ${{ github.token }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ gh release upload "${{ needs.create-release.outputs.railway_version }}" "railway-${{ needs.create-release.outputs.railway_version }}-${{ matrix.target }}.msi"
+
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
diff --git a/Cargo.lock b/Cargo.lock
index 790efe9e9..1cf3cbcaa 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2169,6 +2169,7 @@ dependencies = [
"url",
"which",
"winapi",
+ "winres",
]
[[package]]
@@ -3718,6 +3719,15 @@ dependencies = [
"windows-sys 0.48.0",
]
+[[package]]
+name = "winres"
+version = "0.1.12"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
+dependencies = [
+ "toml",
+]
+
[[package]]
name = "winsafe"
version = "0.0.19"
diff --git a/Cargo.toml b/Cargo.toml
index 4350ae2e4..62d0aa549 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -98,6 +98,9 @@ tokio-util = "0.7.15"
similar = "2.7.0"
pathdiff = "0.2.3"
+[target.'cfg(windows)'.build-dependencies]
+winres = "0.1.12"
+
[profile.release]
lto = "fat"
opt-level = "z"
diff --git a/build.rs b/build.rs
index 22c8b1123..be4932475 100644
--- a/build.rs
+++ b/build.rs
@@ -4,4 +4,13 @@ fn main() {
println!("cargo:rerun-if-changed=src/gql/mutations/strings");
println!("cargo:rerun-if-changed=src/gql/subscriptions/strings");
println!("cargo:rerun-if-changed=src/gql/schema.json");
+
+ #[cfg(windows)]
+ {
+ use winres::WindowsResource;
+
+ let mut res = WindowsResource::new();
+ res.set_manifest_file("railway.exe.manifest").set_icon("wix/logo.ico");
+ res.compile().unwrap();
+ }
}
diff --git a/railway.exe.manifest b/railway.exe.manifest
new file mode 100644
index 000000000..32d556eda
--- /dev/null
+++ b/railway.exe.manifest
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
diff --git a/wix/License.rtf b/wix/License.rtf
new file mode 100644
index 0000000000000000000000000000000000000000..d21ba8411b71b56323eead70a366869022917d83
GIT binary patch
literal 1255
zcmZ8hUu)Ys6yI~9-{H`wZI~?Sx^eH_ljP)fi1j+Atl
z4g!vk&iVa2Mo+c%-K-Ycsk)V2H?6f9Rb%!C;h*ZxXz#ZJ{+ZUDRzux2y|7ODDG;l~
z@Z}kgW`7^0X0%FL$mQ|N^Yi7!Q~kc)NiD7L#sXJOFWc)W%%+p+WcF$L`Qvl_OUdI;
zrQ4f&Y-VtIQ6GeDYbR#^AhEl?sRyBV|3YdGk5=t^4{w`ya6P^L1YD@$C?3PW<;7as
zy>d<&4az|;t=vAs&I;{in?Pr!1k*wAu#*XR142K-L0X3cX6uF0O7B2GgFKq60XYg#MQe<(n>La(ugMElKx1+~S
z7mAJ4VG4bGz(qJY3;{u*?&$S@b+IR~U^d8qjwtdTd$WJ-1S9H3tC12z!I{=zWRdZQ
zY<#E$<((M@a}3rRqgxgHy8ljFtMFKC%`X}Koc61YN4YWbxP&O=wAu5K>jmoH%5!MQ
zjS+{^izRe8Zk@;FYi{4tb{c$zOgx-!xbs<{VIWb
zRxOK71=zt!UOhmu0FpnzSC-Ecpx@V=mL(J%*lL|IiZzy}*=El2JGjNUyr>{!D^?+B
zRYbxw6r(t|fEDHG5|PO*%UJc0z=BnIz+50Gfi>Y3OE($eu-@=>QBtIzBW%v{1xFUT
zqIoqzR;&U2hA&VqNtQ(_vO)Dc>Pw6D17~;33YJASr&zqDsEpiZ^hAZG(u}ZG0&}t=
zcR?M80u$n~?X2#8Nn;852>#NF6?w3c7J0?-H9?oW`ZIdZN}2%StPFuHc!BUCPMipt
ry2Pb*w6+||Isq1BttA*PyVWT5^k(`CE)$@=JMhdU_!hTs2Rj5YkBY|s39$#G5WW8ZqW10g0BQX8
zPuQZ!jE{~%PDUn5bUHMjIfFK%2^NzX=bD;PT3n25@r`RDsSA0fCMDzb`qLO3u)^VR
zV0n2N?yW5-kK65r)9Hj`(t&~ge$?00A|)|N>hX8|L7NGEQ4vN*MzFH7qKFGPx|}Z9
zhK5m8P#}4Px-VRx7#jz(!HD_!`GE5LEts91g`wqLBnV!?>Y&K}sH+Pum&+gPpy}L~
z4=%lrgqYZ%bfA2b!4MJIijvf!wWS3y2M#{qDQs#oSq3-+By;c)qlbJEL5Ymsv68~<@ypS@8qkw
zc=7mgao)4g*zg8^x_ejjMsBsp-8t(Z`Kx`e)`N6iVIeMbbja9lZ?nJ~jC;m6Yx*ab
zFQfO1D;Tn#8zx^mKPeLLAv$7YL{SoSU5!
zcDIHkTk!>TAa?uj5PDJCY#+ACSXTHbd_x@>FFW^-dJI~vn3|fBb)ES^c{rE%4{
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 05548fce0ec12a84ea06051bee755a660ecbdf97 Mon Sep 17 00:00:00 2001
From: jzeuzs <75403863+jzeuzs@users.noreply.github.com>
Date: Sat, 27 Sep 2025 21:05:52 +0800
Subject: [PATCH 2/2] cargo fmt
---
build.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/build.rs b/build.rs
index be4932475..72ce73ddc 100644
--- a/build.rs
+++ b/build.rs
@@ -10,7 +10,8 @@ fn main() {
use winres::WindowsResource;
let mut res = WindowsResource::new();
- res.set_manifest_file("railway.exe.manifest").set_icon("wix/logo.ico");
+ res.set_manifest_file("railway.exe.manifest")
+ .set_icon("wix/logo.ico");
res.compile().unwrap();
}
}