ci/release/msi: Complete

This commit is contained in:
Anmol Sethi 2022-12-18 07:30:09 -08:00
parent 9732ae577e
commit 4495504102
No known key found for this signature in database
GPG key ID: 25BC68888A99A8BA
5 changed files with 64 additions and 1 deletions

View file

@ -144,7 +144,9 @@ main() {
runjob windows/arm64 'OS=windows ARCH=arm64 build' &
waitjobs
runjob linux/dockerimage 'build_docker_image'
runjob linux/dockerimage 'OS=linux build_docker_image' &
runjob windows/amd64/msi 'OS=windows ARCH=amd64 build_windows_msi' &
waitjobs
}
build() {
@ -249,4 +251,25 @@ build_docker_image() {
sh_c docker buildx build $flags -t "$D2_DOCKER_IMAGE:$VERSION" -t "$D2_DOCKER_IMAGE:latest" --build-arg "VERSION=$VERSION" -f ./ci/release/Dockerfile "./ci/release/build/$VERSION"
}
build_windows_msi() {
REMOTE_HOST=$CI_D2_WINDOWS_AMD64
ln -sf "../build/$VERSION/windows-amd64/d2-$VERSION/bin/d2.exe" ./ci/release/windows/d2.exe
sh_c rsync --archive --human-readable --copy-links --delete ./ci/release/windows/ "'$REMOTE_HOST:windows\'"
if ! echo "$VERSION" | grep '[0-9]\.[0-9].[0-9]'; then
WIX_VERSION=0.0.0
else
WIX_VERSION=$VERSION
fi
sh_c ssh "$REMOTE_HOST" "'cd .\\windows && wix build -arch x64 -d D2Version=$WIX_VERSION .\d2.wxs'"
# --files-from shouldn't be necessary but for some reason selecting d2.msi directly
# makes rsync error with:
# ERROR: rejecting unrequested file-list name: .\\windows\\d2.msi
# rsync error: requested action not supported (code 4) at flist.c(1027) [Receiver=3.2.7]
rsync_files=$(mktempd)/rsync-files
echo d2.msi >$rsync_files
sh_c rsync --archive --human-readable --files-from "$rsync_files" "'$REMOTE_HOST:windows\\'" "./ci/release/build/$VERSION/d2-$VERSION-$OS-$ARCH.msi"
}
main "$@"

1
ci/release/windows/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
d2.exe

BIN
ci/release/windows/d2.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
ci/release/windows/d2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

39
ci/release/windows/d2.wxs Normal file
View file

@ -0,0 +1,39 @@
<!--
Wix documentation is nonexistent for v4. What exists is largely out of date and inconsistent.
This file was pieced together from:
1. https://www.firegiant.com/wix/tutorial/getting-started/
- This is for v3, I used wix convert to convert to v4
2. https://wixtoolset.org/docs/reference/schema/wxs/
3. Googling with trial and error
-->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Package Name="D2" UpgradeCode="ac84fee7-eb67-4f5d-a08d-adef69538690" Language="1033" Codepage="utf-8" Version="$(var.D2Version)" Manufacturer="Terrastruct, Inc." InstallerVersion="200">
<SummaryInformation Keywords="Installer" Description="The D2 Installer" Manufacturer="Terrastruct, Inc." Codepage="1252" />
<Icon Id="d2.ico" SourceFile="d2.ico" />
<Property Id="ARPPRODUCTICON" Value="d2.ico" />
<Media Id="1" Cabinet="D2.cab" EmbedCab="yes" />
<Feature Id="Complete" Level="1">
<ComponentRef Id="Executable" />
</Feature>
<MajorUpgrade AllowSameVersionUpgrades='yes' DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
<StandardDirectory Id="ProgramFiles64Folder">
<Directory Id="INSTALLDIR" Name="D2">
<Component Id="Executable" Guid="1090d036-c985-461f-94f6-3121dbcfcb48">
<File Id="D2EXE" Name="d2.exe" Source="d2.exe" KeyPath="yes" />
<Environment
Id="D2PathEntry"
Action="set"
Part="last"
Name="PATH"
Permanent="no"
System="yes"
Value="[INSTALLDIR]" />
</Component>
</Directory>
</StandardDirectory>
</Package>
</Wix>