diff --git a/ci/release/_build.sh b/ci/release/_build.sh index 3f8b1663d..02c58f9db 100755 --- a/ci/release/_build.sh +++ b/ci/release/_build.sh @@ -4,19 +4,23 @@ cd -- "$(dirname "$0")/../.." . ./ci/sub/lib.sh sh_c mkdir -p "$HW_BUILD_DIR" -sh_c rsync --recursive --perms --delete \ - --human-readable --copy-links ./ci/release/template/ "$HW_BUILD_DIR/" -VERSION=$VERSION sh_c eval "'$HW_BUILD_DIR/README.md.sh'" \> "'$HW_BUILD_DIR/README.md'" -sh_c rm -f "$HW_BUILD_DIR/README.md.sh" -sh_c find "$HW_BUILD_DIR" -exec touch {} \\\; +sh_c cp ./ci/release/template/LICENSE.txt "$HW_BUILD_DIR" +sh_c cp ./ci/release/template/Makefile "$HW_BUILD_DIR" +sh_c cp -R ./ci/release/template/man "$HW_BUILD_DIR" +sh_c cp -Rf ./ci/release/template/scripts "$HW_BUILD_DIR" +sh_c VERSION="$VERSION" ./ci/release/template/README.md.sh \> "'$HW_BUILD_DIR/README.md'" ensure_goos ensure_goarch sh_c mkdir -p "$HW_BUILD_DIR/bin" -sh_c CGO_ENABLED=0 go build -trimpath \ +sh_c GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=0 go build -trimpath \ -ldflags "'-X oss.terrastruct.com/d2/lib/version.Version=$VERSION'" \ -o "$HW_BUILD_DIR/bin/d2" . +if [ "$GOOS" = windows ]; then + sh_c mv "$HW_BUILD_DIR/bin/d2" "$HW_BUILD_DIR/bin/d2.exe" +fi + ARCHIVE=$PWD/$ARCHIVE cd "$(dirname "$HW_BUILD_DIR")" sh_c tar -czf "$ARCHIVE" "$(basename "$HW_BUILD_DIR")" diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index 84d6618aa..3fadfa006 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -2,6 +2,8 @@ #### Improvements 🧹 +- The Windows release binary is now suffixed correctly with `.exe` [#388](https://github.com/terrastruct/d2/issues/388) + #### Bugfixes ⛑️ -- Fixed sequence diagram span size for self-edges [#397](https://github.com/terrastruct/d2/pull/397) \ No newline at end of file +- Fixed sequence diagram span size for self-edges [#397](https://github.com/terrastruct/d2/pull/397) diff --git a/ci/release/template/README.md.sh b/ci/release/template/README.md.sh index 2c0cdfb35..d52d96716 100755 --- a/ci/release/template/README.md.sh +++ b/ci/release/template/README.md.sh @@ -1,5 +1,7 @@ #!/bin/sh set -eu +cd -- "$(dirname "$0")/../../.." +. ./ci/sub/lib.sh cat <\` + +For installation you'll have to add the \`./bin/d2.exe\` binary to your \`\$PATH\`. Or add +the \`./bin\` directory of this release to your \`\$PATH\`. + +See https://www.wikihow.com/Change-the-PATH-Environment-Variable-on-Windows + +Then you'll be able to call \`d2\` from the commandline in \`cmd.exe\` or \`pwsh.exe\`. + +We intend to have a \`.msi\` release installer sometime soon that handles putting \`d2\` into +your \`\$PATH\` for you. + +You can also use \`make install\` to install on Windows after first installing +[MSYS2](https://www.msys2.org/) which emulates a Linux shell for Windows. Its terminal +also enables d2 to show colors in its output. The manpage will also become accessible +with \`man d2\`. + +See https://github.com/terrastruct/d2/blob/master/docs/INSTALL.md#windows +EOF +fi + +cat <` + +For installation, you'll have to put the `bin/d2.exe` binary into your `$PATH` or add the +`bin` directory of the release into your `$PATH`. See https://www.wikihow.com/Change-the-PATH-Environment-Variable-on-Windows @@ -176,7 +181,7 @@ Bash](https://gitforwindows.org/#bash) (Git Bash is based on MSYS2) for an impro terminal experience. MSYS2 provides a unix style shell environment that is native to Windows (unlike -[Cygwin](https://www.cygwin.com/)). MSYS2 allows `install.sh` to work, enables proper +[Cygwin](https://www.cygwin.com/)). MSYS2 allows `install.sh` to work, enables automatic installation of our standalone releases via `make install` and makes the manpage accessible via `man d2`.