github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/scripts/release-update-tilt-docs-repo.sh (about) 1 #!/bin/bash 2 # 3 # Updates the Tilt docs repo with the latest version info. 4 # 5 # Usage: 6 # scripts/update-docs-tilt-repo.sh $VERSION 7 # where VERSION is of the form 0.1.0 8 9 set -euo pipefail 10 11 if [[ "${GITHUB_TOKEN-}" == "" ]]; then 12 echo "Missing GITHUB_TOKEN" 13 exit 1 14 fi 15 16 VERSION=${1//v/} 17 VERSION_PATTERN="^[0-9]+\\.[0-9]+\\.[0-9]+$" 18 if ! [[ $VERSION =~ $VERSION_PATTERN ]]; then 19 echo "Version did not match expected pattern. Actual: $VERSION" 20 exit 1 21 fi 22 23 DIR=$(dirname "$0") 24 cd "$DIR/.." 25 26 ROOT=$(mktemp -d) 27 git clone https://tilt-releaser:"$GITHUB_TOKEN"@github.com/tilt-dev/tilt.build "$ROOT" 28 29 set -x 30 VERSION_ARGS="-X main.version=$VERSION -X main.date=$(date +%Y-%m-%d)" 31 go run -mod=vendor -ldflags "$VERSION_ARGS" ./cmd/tilt/main.go dump cli-docs --dir="$ROOT/docs/cli" 32 go run -mod=vendor -ldflags "$VERSION_ARGS" ./cmd/tilt/main.go dump api-docs --dir="$ROOT/api" 33 cd "$ROOT" 34 35 make cli-toc 36 make api 37 38 sed -i -E "s/asdf install tilt .*/asdf install tilt $VERSION/" docs/install.md 39 sed -i -E "s/asdf global tilt .*/asdf global tilt $VERSION/" docs/install.md 40 sed -i -E "s/asdf install tilt .*/asdf install tilt $VERSION/" docs/upgrade.md 41 sed -i -E "s/asdf global tilt .*/asdf global tilt $VERSION/" docs/upgrade.md 42 43 # the sed pattern doesn't need to match the whole string. 44 SED_VERSION_PATTERN="[0-9]+\\.[0-9]+\\.[0-9]+" 45 sed -i -E "s|/download/v$SED_VERSION_PATTERN/tilt.$SED_VERSION_PATTERN|/download/v$VERSION/tilt.$VERSION|" docs/install.md 46 sed -i -E "s|/download/v$SED_VERSION_PATTERN/tilt.$SED_VERSION_PATTERN|/download/v$VERSION/tilt.$VERSION|" docs/upgrade.md 47 git add . 48 49 git commit -a -m "Update docs to Tilt version: $VERSION" 50 git push origin master 51 52 rm -fR "$ROOT"