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..72ce73ddc 100644 --- a/build.rs +++ b/build.rs @@ -4,4 +4,14 @@ 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 000000000..d21ba8411 Binary files /dev/null and b/wix/License.rtf differ diff --git a/wix/logo.ico b/wix/logo.ico new file mode 100644 index 000000000..96a637f7f Binary files /dev/null and b/wix/logo.ico differ diff --git a/wix/main.wxs b/wix/main.wxs new file mode 100644 index 000000000..f0d4e9b0f --- /dev/null +++ b/wix/main.wxs @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +