From d8b54c2e4251b3ad8d9ead3fb0c36ec1c61b9eaa Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Sun, 13 Nov 2022 16:57:47 -0800 Subject: [PATCH] ci/release: Full docs --- ci/release/README.md | 46 ++++++++++++++++++++++++++++++++++++++- ci/release/_install.sh | 5 +++++ ci/release/build.sh | 15 ++++--------- ci/release/gen_install.sh | 2 ++ ci/release/release.sh | 8 ------- ci/sub | 2 +- 6 files changed, 57 insertions(+), 21 deletions(-) create mode 100755 ci/release/_install.sh create mode 100755 ci/release/gen_install.sh diff --git a/ci/release/README.md b/ci/release/README.md index af207b18d..8833ecd0e 100644 --- a/ci/release/README.md +++ b/ci/release/README.md @@ -1,3 +1,47 @@ # release -Run `./release.sh --help` for instructions. +## _install.sh + +The template for the install script in the root of the repository. + +### gen_install.sh + +Generates the install.sh script in the root of the repository by prepending the libraries +it depends on from ../sub/lib. + +## release.sh + +- ./release.sh is the top level script to generate a new release. + Run with --help for usage. + +## build.sh + +- ./build.sh builds the release archives for each platform into ./build//*.tar.gz + Run with --help for usage. + +> note: Remember for production releases you need to set the $TSTRUCT_OS_ARCH_BUILDER +> variables as we must compile d2 directly on each release target to include dagre. +> See https://github.com/terrastruct/d2/issues/31 + +### build_docker.sh + +Helper script called by build.sh to build D2 on each linux runner inside Docker. +The Dockerfile is in ./builders/Dockerfile + +### _build.sh + +Called by build.sh (with --local or macOS) or build_docker.sh (on linux) to create the +release archive. + +Do not invoke directly. If you want to produce a build for a single platform run build.sh +as so: + +```sh + # To only build the linux-amd64 release. +./build.sh --run=linux-amd64 +``` + +```sh + # To only build the linux-amd64 release locally. +./build.sh --local --run=linux-amd64 +``` diff --git a/ci/release/_install.sh b/ci/release/_install.sh new file mode 100755 index 000000000..6f4f2d794 --- /dev/null +++ b/ci/release/_install.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -eu + +$LOG_SH +$RAND_SH diff --git a/ci/release/build.sh b/ci/release/build.sh index 7a8420f89..34570ed52 100755 --- a/ci/release/build.sh +++ b/ci/release/build.sh @@ -27,17 +27,6 @@ EOF } main() { - unset FLAG \ - FLAGRAW \ - FLAGARG \ - FLAGSHIFT \ - VERSION \ - BUILD_DIR \ - HW_BUILD_DIR \ - REBUILD \ - LOCAL \ - DRYRUN \ - ARCHIVE VERSION="$(git_describe_ref)" BUILD_DIR="ci/release/build/$VERSION" while :; do @@ -62,6 +51,10 @@ main() { DRYRUN=1 shift "$FLAGSHIFT" ;; + run) + flag_reqarg + JOB_FILTER="$FLAGARG" + shift "$FLAGSHIFT" '') shift "$FLAGSHIFT" break diff --git a/ci/release/gen_install.sh b/ci/release/gen_install.sh new file mode 100755 index 000000000..92b70ea0d --- /dev/null +++ b/ci/release/gen_install.sh @@ -0,0 +1,2 @@ +#!/bin/sh +set -eu diff --git a/ci/release/release.sh b/ci/release/release.sh index df9e9be7c..a87b7f37e 100755 --- a/ci/release/release.sh +++ b/ci/release/release.sh @@ -63,14 +63,6 @@ EOF } main() { - unset FLAG \ - FLAGRAW \ - FLAGARG \ - FLAGSHIFT \ - VERSION \ - REBUILD \ - PRERELEASE \ - DRYRUN while :; do flag_parse "$@" case "$FLAG" in diff --git a/ci/sub b/ci/sub index 3be3f2345..5d23dec92 160000 --- a/ci/sub +++ b/ci/sub @@ -1 +1 @@ -Subproject commit 3be3f2345e3cd75f2570afdcebfdf2d3732e5dda +Subproject commit 5d23dec92cee36692bc8c8cece74890cce9631e4