diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 071d84f6..e0cb4c21 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -66,14 +66,17 @@ jobs: - target: x86_64-pc-windows-msvc os: windows-latest name: starship-x86_64-pc-windows-msvc.zip + rustflags: -C target-feature=+crt-static - target: i686-pc-windows-msvc os: windows-latest name: starship-i686-pc-windows-msvc.zip + rustflags: -C target-feature=+crt-static - target: aarch64-pc-windows-msvc os: windows-latest name: starship-aarch64-pc-windows-msvc.zip + rustflags: -C target-feature=+crt-static - target: x86_64-unknown-freebsd os: ubuntu-latest @@ -81,6 +84,8 @@ jobs: runs-on: ${{ matrix.os }} continue-on-error: true + env: + RUSTFLAGS: ${{ matrix.rustflags || '' }} steps: - name: Setup | Checkout uses: actions/checkout@v3 @@ -93,6 +98,15 @@ jobs: profile: minimal target: ${{ matrix.target }} + - name: Setup | Install cargo-wix [Windows] + continue-on-error: true + # aarch64 is only supported in wix 4.0 development builds + if: matrix.os == 'windows-latest' && matrix.target != 'aarch64-pc-windows-msvc' + run: cargo install --version 0.3.2 cargo-wix + env: + # cargo-wix does not require static crt + RUSTFLAGS: '' + - name: Build | Build uses: actions-rs/cargo@v1.0.3 with: @@ -100,6 +114,14 @@ jobs: args: --release --locked --target ${{ matrix.target }} use-cross: ${{ matrix.os == 'ubuntu-latest' }} + - name: Build | Installer [Windows] + continue-on-error: true + if: matrix.os == 'windows-latest' && matrix.target != 'aarch64-pc-windows-msvc' + uses: actions-rs/cargo@v1.0.3 + with: + command: wix + args: -v --nocapture -I install/windows/main.wxs --target ${{ matrix.target }} --output target/wix/starship.msi + - name: Post Build | Prepare artifacts [Windows] if: matrix.os == 'windows-latest' run: | @@ -123,6 +145,14 @@ jobs: name: ${{ matrix.name }} path: ${{ matrix.name }} + - name: Release | Upload installer artifacts [Windows] + continue-on-error: true + if: matrix.os == 'windows-latest' && matrix.target != 'aarch64-pc-windows-msvc' + uses: actions/upload-artifact@v3 + with: + name: starship-${{ matrix.target }}.msi + path: target/wix/starship.msi + # Notarize starship binaries for MacOS and build notarized pkg installers notarize_and_pkgbuild: runs-on: macos-latest diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 1313cf1d..435c3091 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -166,6 +166,11 @@ jobs: matrix: os: [ubuntu-latest, macOS-latest, windows-latest] rust: [stable, nightly] + include: + - os: windows-latest + rustflags: -C target-feature=+crt-static + env: + RUSTFLAGS: ${{ matrix.rustflags || '' }} steps: - name: Setup | Checkout uses: actions/checkout@v3 @@ -185,6 +190,18 @@ jobs: - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov + # For windows installer test + # On stable rust & main repo pushes only + - name: Install cargo-wix [Windows] + continue-on-error: true + if: > + matrix.os == 'windows-latest' && matrix.rust == 'stable' && + github.repository == 'starship/starship' && github.event.type == 'push_event' + run: cargo install --version 0.3.2 cargo-wix + env: + # cargo-wix does not require static crt + RUSTFLAGS: '' + # Install Mercurial (pre-installed on Linux and windows) - name: Setup | Mercurial (macos) if: matrix.os == 'macOS-latest' @@ -202,6 +219,16 @@ jobs: # Avoid -D warnings on nightly builds RUSTFLAGS: "" + - name: Build | Installer [Windows] + continue-on-error: true + if: > + matrix.os == 'windows-latest' && matrix.rust == 'stable' && + github.repository == 'starship/starship' && github.event.type == 'push_event' + uses: actions-rs/cargo@v1.0.3 + with: + command: wix + args: --dbg-build -v --nocapture -I install/windows/main.wxs + - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 if: github.repository == 'starship/starship' diff --git a/README.md b/README.md index bff7ba15..9ac75d75 100644 --- a/README.md +++ b/README.md @@ -251,6 +251,8 @@ Alternatively, install Starship using any of the following package managers:
Windows +Install the latest version for your system with the MSI-installers from the [releases section](https://github.com/starship/starship/releases/latest). + Install Starship using any of the following package managers: | Repository | Instructions | diff --git a/build.rs b/build.rs index f6c76935..38b4e1ac 100644 --- a/build.rs +++ b/build.rs @@ -6,7 +6,8 @@ fn main() -> Result<(), Box> { #[cfg(windows)] { let mut res = winres::WindowsResource::new(); - res.set_manifest_file("starship.exe.manifest"); + res.set_manifest_file("starship.exe.manifest") + .set_icon("media/icon.ico"); res.compile()?; } diff --git a/install/windows/main.wxs b/install/windows/main.wxs new file mode 100644 index 00000000..41c2280b --- /dev/null +++ b/install/windows/main.wxs @@ -0,0 +1,183 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 1 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/install/windows/pkg_resources/Banner.bmp b/install/windows/pkg_resources/Banner.bmp new file mode 100644 index 00000000..9a5062bb Binary files /dev/null and b/install/windows/pkg_resources/Banner.bmp differ diff --git a/install/windows/pkg_resources/Dialog.bmp b/install/windows/pkg_resources/Dialog.bmp new file mode 100644 index 00000000..4a16245e Binary files /dev/null and b/install/windows/pkg_resources/Dialog.bmp differ diff --git a/install/windows/pkg_resources/LICENSE.rtf b/install/windows/pkg_resources/LICENSE.rtf new file mode 100644 index 00000000..62fb9f96 --- /dev/null +++ b/install/windows/pkg_resources/LICENSE.rtf @@ -0,0 +1,4 @@ +{\pard \ql \f0 \sa180 \li0 \fi0 ISC License\par} +{\pard \ql \f0 \sa180 \li0 \fi0 Copyright (c) 2019-2022, Starship Contributors\par} +{\pard \ql \f0 \sa180 \li0 \fi0 Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.\par} +{\pard \ql \f0 \sa180 \li0 \fi0 THE SOFTWARE IS PROVIDED \u8220"AS IS\u8221" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\par} diff --git a/media/icon.ico b/media/icon.ico new file mode 100644 index 00000000..50853412 Binary files /dev/null and b/media/icon.ico differ