#!/bin/bash # Build a release's files in dist/ with GoReleaser (.goreleaser.yaml), from git (only what's committed): # devvm---.tar.gz the binary and the files it reads, for darwin and linux, arm64 and amd64 # devvm-.tar.gz the source, for whoever builds devvm themselves # SHA256SUMS their checksums and install.sh's, which install.sh checks # SHA256SUMS.minisig SHA256SUMS signed with the release key (minisign), which install.sh checks # install.sh the install script, set to install this release and to trust the key # devvm-rc.rb the Homebrew formula devvm-rc for devvmhq/homebrew-tap, which follows # prereleases: each platform's archive # devvm.rb for a release, not a prerelease, the formula devvm too # Nothing is published. The version is VERSION's: x.y.z, or a prerelease's x.y.z-rc.N (any lowercase word, # such as beta or alpha, then a number). The public key is packaging/minisign.pub (committed); the secret key # is the maintainer's, at DEVVM_MINISIGN_KEY (default ~/.minisign/devvm.key), never in the repo. # Every file but the signature is built in one container image, with the Go and GoReleaser that the # built commit's mise.lock pins, so every builder makes the same bytes (scripts/repro-check.sh checks # it). The image and the build's own code, this script's build below, are the built commit's copy of # this script's, so a tag builds the same from any checkout. The build has no network: the Go modules # it needs are downloaded first, in a container of this checkout's, with this checkout's Go (modules # below). What runs here, outside the containers, is this checkout's: the tag's checks, the # downloads, the checks on what the build wrote, and the signature, made after the containers are # gone. Nothing of the built commit's runs outside its container, which runs with no capabilities, # no new privileges, bounded processes and memory, and a time limit kept here, but it does run: it's # as isolated as the container runtime keeps it. # scripts/release.sh from the tag v, which must exist and be signed (git tag -s) # scripts/release.sh --tag TAG # the tag TAG's build, as its release's, with the same checks, but not # signed, to compare with the published SHA256SUMS # scripts/release.sh --head from HEAD, for testing, with HEAD's VERSION (DEVVM_RELEASE_URL: where the # archives will be; DEVVM_MINISIGN_KEY: a test key, else nothing is signed; # DEVVM_MINISIGN_PUB: its public key, else packaging/minisign.pub) # scripts/release.sh --commit COMMIT # the same, from COMMIT # scripts/release.sh --check only the tag's checks and what the build needs, then prints the tag's commit # (scripts/publish.sh --local runs it first); nothing is built # scripts/release.sh --check-tag # only the tag's checks, the release keys' among them, then prints the tag's # commit, needing no container runtime (scripts/publish.sh runs it first) # scripts/release.sh --sign-legacy DIR # while releases bridge from the old release key: VERSION's SHA256SUMS in # DIR, whose SHA256SUMS.ci.minisig and SHA256SUMS.cosign.minisig have to # check out with packaging/keys and the trusted comment devvm-release # , signed with the old key (DEVVM_MINISIGN_KEY, which asks for its # password) as DIR/SHA256SUMS.minisig, devvm , and checked with # packaging/minisign.pub (scripts/publish.sh --sign-legacy runs it) # scripts/release.sh --formula-from DIR # only the formulas, for VERSION's published release, from its SHA256SUMS # and SHA256SUMS.minisig downloaded into DIR, checked against minisign.pub # and its trusted comment, devvm # scripts/release.sh --ci TAG DIR # CI's build of the tag TAG (.github/workflows/release.yml): TAG checked # against DEVVM_RELEASE_SIGNERS, an allowed signers file, never the tag's # pin, and that it's annotated, names itself and is on main # (DEVVM_RELEASE_MAIN, refs/remotes/origin/main by default), then --tag's # build, then DIR, a folder that doesn't exist yet, with SHA256SUMS and # exactly the files it lists, for the co-signer # scripts/release.sh --ci-sign TAG DIR # DIR/SHA256SUMS signed with CI's release key, read from standard input and # never written to a file, as DIR/SHA256SUMS.ci.minisig, with the trusted # comment devvm-release , checked with TAG's # packaging/keys/release-ci.pub, which mustn't be a placeholder # Needs podman or Docker (DEVVM_RELEASE_RUNTIME names one, else podman is tried first), git, curl, and # minisign to sign, pinned in mise.toml: mise exec -- scripts/release.sh. The downloads are kept in # ${XDG_CACHE_HOME:-~/.cache}/devvm-release, by their SHA-256, and checked again before each build. # Each container is removed after DEVVM_RELEASE_TIMEOUT seconds (two hours by default), or as soon # as this script stops early: Ctrl+C, a closed terminal, kill, or kill -9. An unsigned build never # replaces a dist/ that holds a signature, nor a test build one signed with the release key: move # it, or set DEVVM_RELEASE_DIST. # scripts/repro-check.sh sets DEVVM_RELEASE_SRC, a repository to fetch the commit and the tag from in # place of this one (they're still checked here, by their hashes), and DEVVM_RELEASE_DIST, a folder # that doesn't exist yet, for the files in place of dist/. The tests set DEVVM_RELEASE_TEST_FILE_URLS # to the folder of their own tarballs, the one folder mise.lock's downloads may then name by file:// # URL; it has to exist, and not be /. set -euo pipefail # Every file this script writes, in the container or here, is 0755 or 0644, whatever your umask: # minisign writes its signatures with it, and Ubuntu's, 0002, would leave them writable by your group. umask 022 die() { echo "release: $*" >&2; exit 1; } # The container this commit's release is built in, on every builder: Debian's, with git, by its # index's digest (scripts/bump.sh release-image), so git, which writes the source tarball, and awk, # tar and gzip are the same everywhere. A build reads it from the built commit's copy of this script, # and the modules' download from this checkout's. release_image=docker.io/library/buildpack-deps:trixie-scm@sha256:23479f0336f9f8dca3bc45bb0d5ad61c47993892cc31248455e08f43117fb682 # sha256 FILE: its SHA-256, with sha256sum (coreutils) or shasum (macOS's). sha256() { { sha256sum "$1" 2>/dev/null || shasum -a 256 "$1"; } | cut -c1-64; } # set_names VERSION: the Homebrew formulas VERSION gets, in names: devvm-rc, which follows prereleases, for # every release, and devvm for a release that isn't a prerelease. set_names() { names=(devvm-rc) [[ $1 == *-* ]] || names=(devvm devvm-rc) } # formula TEMPLATE SUMS URL VERSION NAME: the Homebrew formula NAME, devvm or devvm-rc, from its template: # its class, the other formula, which it conflicts with (by its full name, which no other tap's devvm # makes ambiguous), and each platform's archive's URL and its checksum from SHA256SUMS (on lines that # aren't comments). formula() { local class other case $5 in devvm) class=Devvm other=devvmhq/tap/devvm-rc ;; devvm-rc) class=DevvmRc other=devvmhq/tap/devvm ;; *) echo "no formula $5" >&2; return 1 ;; esac awk -v sums="$2" -v u="$3" -v v="$4" -v class="$class" -v other="$other" ' BEGIN { while ((getline line < sums) > 0) { split(line, f, " "); sha[f[2]] = f[1] } split("darwin linux", oses, " "); split("arm64 amd64", arches, " ") } !/^#/ { gsub("@CLASS@", class); gsub("@CONFLICTS@", other) for (i in oses) for (j in arches) { p = toupper(oses[i] "_" arches[j]); a = "devvm-" v "-" oses[i] "-" arches[j] ".tar.gz" if (index($0, "@SHA256_" p "@")) { if (sha[a] !~ /^[0-9a-f]+$/ || length(sha[a]) != 64) { print "SHA256SUMS has no " a > "/dev/stderr"; bad = 1 } gsub("@SHA256_" p "@", sha[a]) } gsub("@URL_" p "@", u "/" a) } if (/@[A-Z0-9_]+@/) { print "the formula has a placeholder left: " $0 > "/dev/stderr"; bad = 1 } } { print } END { exit bad }' "$1" } # formulas TEMPLATE SUMS URL OUT: VERSION's formulas (names), each as OUT/.rb. formulas() { local n for n in "${names[@]}"; do formula "$1" "$2" "$3" "$v" "$n" > "$4/$n.rb" || return 1; done } # build VERSION COMMIT URL PUBKEY MODS OUT: the build, in the container, with no network, in its work # folder (the current one), which holds src (a clone of the repo, not checked out) and dl (go.tar.gz # and goreleaser.tar.gz, checked against mise.lock). MODS holds the Go modules the commit needs, as a # GOPROXY's files (modules below), read-only. It builds in src/dist, then copies to OUT, a folder of # its own: GoReleaser's files, install.sh set to VERSION and PUBKEY ("" for an unsigned test build), # the formulas for the archives at URL, and SHA256SUMS with install.sh's line. Only what the commit # and the container hold decides the bytes: the paths, the user, the umask, the zone and the locale # are the same on every builder. build() { local commit=$2 url=$3 pubkey=$4 mods=$5 dest=$6 work=$PWD snap=() arch bin got v=$1 set_names "$v" # The tools, HOME and Go's caches go in a folder of the container's own, not the shared work folder: # Docker Desktop's share loses files that Go's parallel module downloads rename. Their paths never # reach the files built (-trimpath). Not local: the trap reads it once build has returned. local_=$(mktemp -d "${TMPDIR:-/tmp}/devvm-release-build.XXXXXX") trap 'rm -rf "$local_"' EXIT export HOME=$local_/home TZ=UTC LC_ALL=C.UTF-8 CGO_ENABLED=0 GOTOOLCHAIN=local GOFLAGS="-mod=readonly -modcacherw" \ GOPATH=$local_/go GOCACHE=$local_/cache GOPROXY=file://$mods GOWORK=off GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null \ GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=safe.directory GIT_CONFIG_VALUE_0='*' mkdir -p "$HOME" "$local_/tools/goreleaser" # --no-same-owner: the container has no capabilities, so root in it can't give files the tarballs' # owners. { tar --no-same-owner -xzf dl/go.tar.gz -C "$local_/tools" && tar --no-same-owner -xzf dl/goreleaser.tar.gz -C "$local_/tools/goreleaser"; } || die "couldn't unpack Go and GoReleaser" [[ -x $local_/tools/go/bin/go && -x $local_/tools/goreleaser/goreleaser ]] || die "mise.lock's Go or GoReleaser download holds no go/bin/go or goreleaser" export PATH=$local_/tools/go/bin:$local_/tools/goreleaser:$PATH git -C src checkout -q --detach "$commit" || die "couldn't check out $commit" [[ -n ${GORELEASER_CURRENT_TAG:-} ]] || snap=(--snapshot) (cd src && DEVVM_VERSION=$v goreleaser release --clean --skip=publish ${snap[@]+"${snap[@]}"}) || die "goreleaser failed" local out=$work/src/dist # The built binary for the container's system says the release's version (GoReleaser's own default # sets one devvm doesn't read). case $(uname -m) in arm64 | aarch64) arch=arm64 ;; x86_64) arch=amd64 ;; *) arch=none ;; esac for bin in "$out"/devvm*_linux_"$arch"*/devvm; do [[ -x $bin ]] || continue got=$("$bin" --version) || die "$bin --version failed" [[ $got == "$v" ]] || die "$bin --version says '$got', not $v" done git -C src show "$commit:install.sh" | awk -v v="$v" -v k="$pubkey" ' /^release_version=""$/ { $0 = "release_version=\"" v "\""; n++ } /^minisign_key=""$/ { $0 = "minisign_key=\"" k "\""; m++ } { print } END { exit !(n == 1 && m == 1) }' \ > "$out/install.sh" || die "install.sh needs one release_version=\"\" and one minisign_key=\"\" line" chmod 755 "$out/install.sh" git -C src show "$commit:packaging/homebrew/devvm.rb" > "$work/devvm.rb" || die "no packaging/homebrew/devvm.rb in $commit" formulas "$work/devvm.rb" "$out/SHA256SUMS" "$url" "$out" || die "couldn't write the formulas" # install.sh's checksum goes in SHA256SUMS before it's signed, so you can check the script against the # release key before you run it. (cd "$out" && echo "$(sha256 install.sh) install.sh" >> SHA256SUMS) || die "couldn't add install.sh to SHA256SUMS" cp -RP "$out/." "$dest/" || die "couldn't copy dist/ to $dest" } # modules IN OUT: in the modules' container, the one with the network, this checkout's code, image # and Go: the modules that IN's go.mod and go.sum need, downloaded with this checkout's Go # (IN/go.tar.gz, from Google's downloads, checked against this checkout's mise.lock) from Go's # module proxy alone, into OUT as a GOPROXY's files, for the build. Downloading runs none of the # modules' code, and nothing of the commit's but those two files goes in. Every module path they # name is looked up on Go's public proxy and checksum database, Google's. modules() { local in=$1 dest=$2 local_=$(mktemp -d "${TMPDIR:-/tmp}/devvm-release-modules.XXXXXX") trap 'rm -rf "$local_"' EXIT export HOME=$local_/home GOPATH=$local_/go GOMODCACHE=$local_/go/pkg/mod GOCACHE=$local_/cache CGO_ENABLED=0 \ GOTOOLCHAIN=local GOWORK=off GOFLAGS=-modcacherw GOPROXY=https://proxy.golang.org GOSUMDB=sum.golang.org \ GONOSUMDB='' GONOPROXY='' GOPRIVATE='' GOVCS='*:off' mkdir -p "$HOME" "$local_/tools" "$local_/m" tar --no-same-owner -xzf "$in/go.tar.gz" -C "$local_/tools" || die "couldn't unpack Go" cp "$in/go.mod" "$in/go.sum" "$local_/m/" || die "couldn't copy go.mod and go.sum" (cd "$local_/m" && "$local_/tools/go/bin/go" mod download) || die "couldn't download the Go modules" [[ ! -d $GOMODCACHE/cache/download ]] || cp -R "$GOMODCACHE/cache/download/." "$dest/" || die "couldn't copy the Go modules to $dest" } # In a container: the built commit's release.sh _build VERSION COMMIT URL PUBKEY MODS OUT, which the # build below runs, and this checkout's release.sh _modules IN OUT. Every release.sh keeps _build's # arguments, since a checkout builds other commits with theirs. case ${1:-} in _build) shift; build "$@"; exit 0 ;; _modules) shift; modules "$@"; exit 0 ;; esac root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" cd "$root" # valid_version VERSION: a release, x.y.z, or a prerelease of one, x.y.z-.N (such as 0.2.0-rc.1 # or 0.2.0-beta.2). valid_version() { [[ $1 =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$ ]]; } # version_file: v, this checkout's VERSION. version_file() { v=$(tr -d '[:space:]' < VERSION) valid_version "$v" || die "VERSION isn't x.y.z or x.y.z-rc.N: '$v'" } # tag_version TAG WHAT: v, the version of TAG, a release's tag, v, or WHAT refuses it. tag_version() { v=${1#v} { [[ $1 == v* ]] && valid_version "$v"; } || die "$2 needs a release's tag, v, not '$1'" } # A release's devvm and install.sh check releases with the release keys in its commit's packaging/keys # and install.sh's release__key lines. A devvm with some of the three keys refuses every # upgrade, so a release has none of them or all three. With none, as until the real keys are made, # install.sh's lines are empty, and the release is checked with the old release key alone. With all # three, each is a minisign public key, a different one, not a placeholder, and the same as # install.sh's line. A placeholder is a key marked PLACEHOLDER in its comment, such as a stand-in # that nobody holds the secret half of. Only a snapshot, a test build, may have one. # placeholder PUB: whether PUB, a .pub file's text, is marked PLACEHOLDER in its comment. placeholder() { [[ $(sed -n 1p <<<"$1") == *PLACEHOLDER* ]]; } # ci TAG DIR: CI's build of TAG for the co-signer, in DIR (--ci). The tag is checked against # DEVVM_RELEASE_SIGNERS, never the tag's own packaging/release-signer, as CI runs the tag's workflow # and this script from the tag's commit: the signers are the environment's, which no tag can change. ci() { local tag=$1 dir=$2 signers=${DEVVM_RELEASE_SIGNERS:-} main=${DEVVM_RELEASE_MAIN:-refs/remotes/origin/main} local named commit sum name n=0 tag_version "$tag" --ci [[ -n $signers && -s $signers ]] || die "--ci needs DEVVM_RELEASE_SIGNERS, an allowed signers file of the keys that sign release tags" [[ $dir == /* && ! -e $dir && ! -L $dir ]] || die "--ci's folder isn't an absolute path that doesn't exist yet: '$dir'" [[ $(git cat-file -t "refs/tags/$tag" 2>/dev/null) == tag ]] || die "no annotated tag $tag (git tag -s $tag)" # The tag object names the tag it was made as, which its signature covers: one pushed under # another name is another release's. named=$(git cat-file tag "refs/tags/$tag" | sed -n '/^$/q; s/^tag //p') [[ $named == "$tag" ]] || die "the tag $tag is the tag object of $named, not its own" git -c gpg.ssh.allowedSignersFile="$signers" verify-tag "refs/tags/$tag" >/dev/null 2>&1 || die "tag $tag isn't signed by a key in DEVVM_RELEASE_SIGNERS" commit=$(git rev-parse -q --verify "refs/tags/$tag^{commit}") || die "no commit for $tag" git merge-base --is-ancestor "$commit" "$main" 2>/dev/null || die "tag $tag's commit ${commit:0:12} isn't on main ($main)" # --tag refuses one or two keys, or a placeholder; CI's build needs all three. git cat-file -e "$commit:packaging/keys/release-ci.pub" 2>/dev/null || die "$tag has no release keys in packaging/keys, so its devvm can't check CI's and the co-signer's signatures: make them first (docs/content/docs/contributing/github-setup.md, step 1), or publish it with scripts/publish.sh --local" # Not local: the trap reads it once ci has returned. tmp=$(mktemp -d "${TMPDIR:-/tmp}/devvm-release-ci.XXXXXX") trap 'rm -rf "$tmp"' EXIT # --tag's build, whose git checks the tag again with the same signers, as git's own. DEVVM_RELEASE_DIST=$tmp/dist GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=gpg.ssh.allowedSignersFile GIT_CONFIG_VALUE_0=$signers \ "$root/scripts/release.sh" --tag "$tag" || die "the build of $tag failed" # The co-signer takes SHA256SUMS and exactly the files it lists, each a plain name, and nothing # else: the formulas aren't listed, as it renders them itself. mkdir "$dir" while read -r sum name; do [[ $sum =~ ^[0-9a-f]{64}$ && $name =~ ^[A-Za-z0-9][A-Za-z0-9._+-]*$ && -f $tmp/dist/$name && ! -L $tmp/dist/$name ]] || die "the build's SHA256SUMS has a line that isn't one of its files: '$sum $name'" cp "$tmp/dist/$name" "$dir/$name" [[ $(sha256 "$dir/$name") == "$sum" ]] || die "$name doesn't match the build's SHA256SUMS" n=$((n + 1)) done < "$tmp/dist/SHA256SUMS" cp "$tmp/dist/SHA256SUMS" "$dir/SHA256SUMS" echo "==> $dir/ for the co-signer: SHA256SUMS and the $n files it lists, from $tag" } # ci_sign TAG DIR: DIR/SHA256SUMS signed with CI's release key, on standard input (--ci-sign). The # key is read into this script's memory and handed to minisign through a pipe, so it's never in a # file, and never in an argument. ci_sign() { local tag=$1 dir=$2 commit pub key out sig tag_version "$tag" --ci-sign sig=$dir/SHA256SUMS.ci.minisig [[ -f $dir/SHA256SUMS && ! -L $dir/SHA256SUMS ]] || die "--ci-sign needs $dir/SHA256SUMS" [[ ! -e $sig && ! -L $sig ]] || die "$dir already has SHA256SUMS.ci.minisig" command -v minisign >/dev/null || die "needs minisign to sign SHA256SUMS (mise exec -- scripts/release.sh)" commit=$(git rev-parse -q --verify "refs/tags/$tag^{commit}") || die "no tag $tag" pub=$(git show "$commit:packaging/keys/release-ci.pub" 2>/dev/null) || die "$tag has no packaging/keys/release-ci.pub: make the release keys first (docs/content/docs/contributing/github-setup.md, step 1)" ! placeholder "$pub" || die "$tag's packaging/keys/release-ci.pub is a placeholder key: make the real release keys first (docs/content/docs/contributing/github-setup.md, step 1)" [[ ! -t 0 ]] && key=$(cat) && [[ -n $key ]] || die "--ci-sign read no key on its standard input: CI's release key, an unencrypted minisign secret key" minisign -S -s <(printf '%s\n' "$key") -m "$dir/SHA256SUMS" -x "$sig" -t "devvm-release $v" /dev/null || { rm -f "$sig"; die "couldn't sign $dir/SHA256SUMS with the key on standard input, which must be an unencrypted minisign secret key (minisign -G -W)"; } key= out=$(minisign -V -P "$(sed -n 2p <<<"$pub")" -m "$dir/SHA256SUMS" -x "$sig" 2>/dev/null) || { rm -f "$sig"; die "$sig doesn't verify with $tag's packaging/keys/release-ci.pub: the key on standard input isn't CI's release key"; } [[ $(sed -n 's/^Trusted comment: //p' <<<"$out") == "devvm-release $v" ]] || { rm -f "$sig"; die "$sig isn't signed as devvm-release $v"; } echo "==> $sig, signed as devvm-release $v" } # sign_legacy DIR: VERSION's SHA256SUMS in DIR, which CI and the co-signer signed, signed with the old # release key for devvm 0.1 and 0.2, while releases bridge from it (--sign-legacy). Both signatures # are checked with this checkout's packaging/keys first, so the old key signs only what two builders # built and signed. sign_legacy() { local dir=$1 key=${DEVVM_MINISIGN_KEY:-$HOME/.minisign/devvm.key} r f out got version_file [[ -f $dir/SHA256SUMS ]] || die "--sign-legacy needs $dir/SHA256SUMS" [[ ! -e $dir/SHA256SUMS.minisig ]] || die "$dir already has SHA256SUMS.minisig" command -v minisign >/dev/null || die "needs minisign to sign SHA256SUMS (mise exec -- scripts/release.sh)" [[ -f $key ]] || die "no release key at $key (DEVVM_MINISIGN_KEY)" [[ -f $root/packaging/keys/release-ci.pub && -f $root/packaging/keys/release-cosign.pub ]] || die "--sign-legacy checks CI's and the co-signer's signatures with the release keys in packaging/keys, which has none: make them first (docs/content/docs/contributing/github-setup.md, step 1)" for r in ci cosign; do f=$dir/SHA256SUMS.$r.minisig [[ -f $f ]] || die "--sign-legacy needs $f" out=$(minisign -V -p "$root/packaging/keys/release-$r.pub" -m "$dir/SHA256SUMS" -x "$f" 2>/dev/null) || die "$f doesn't verify with packaging/keys/release-$r.pub" got=$(sed -n 's/^Trusted comment: //p' <<<"$out") [[ $got == "devvm-release $v" ]] || die "$f is signed as '$got', not 'devvm-release $v'" done minisign -Sm "$dir/SHA256SUMS" -s "$key" -x "$dir/SHA256SUMS.minisig" -t "devvm $v" || { rm -f "$dir/SHA256SUMS.minisig"; die "couldn't sign $dir/SHA256SUMS"; } minisign -Vm "$dir/SHA256SUMS" -x "$dir/SHA256SUMS.minisig" -p "$root/packaging/minisign.pub" >/dev/null || { rm -f "$dir/SHA256SUMS.minisig"; die "$dir/SHA256SUMS.minisig doesn't verify with packaging/minisign.pub"; } } # What's built: the tag ref, or a snapshot of the commit ref (--head, --commit), which takes its # version from the commit's VERSION. A release is signed, --tag's build never is, and a snapshot only # with a test key. check=false tagonly=false snapshot=false unsigned=false case ${1:-} in --head) snapshot=true ref=HEAD ;; --commit) [[ $# == 2 && -n ${2:-} ]] || die "--commit needs one commit" snapshot=true ref=$2 ;; --tag) [[ $# == 2 ]] || die "--tag needs one tag, v" ref=$2 v=${2#v} unsigned=true { [[ $ref == v* ]] && valid_version "$v"; } || die "--tag needs a release's tag, v, not '$ref'" ;; --check) check=true ;; --formula-from) version_file set_names "$v" # The formulas for a published release, from its downloaded SHA256SUMS and SHA256SUMS.minisig in # DIR, checked against packaging/minisign.pub, and signed as VERSION's release: its trusted comment # is devvm , as this script signs it. Nothing is built. dir=${2:-} [[ -n $dir && -f $dir/SHA256SUMS && -f $dir/SHA256SUMS.minisig ]] || die "--formula-from DIR needs DIR/SHA256SUMS and DIR/SHA256SUMS.minisig" command -v minisign >/dev/null || die "needs minisign (mise exec -- scripts/release.sh)" verified=$(minisign -Vm "$dir/SHA256SUMS" -x "$dir/SHA256SUMS.minisig" -p packaging/minisign.pub) || die "$dir/SHA256SUMS doesn't verify with packaging/minisign.pub" comment=$(sed -n 's/^Trusted comment: //p' <<<"$verified") [[ $comment == "devvm $v" ]] || die "$dir/SHA256SUMS is signed as '$comment', not VERSION's 'devvm $v'" mkdir -p dist formulas packaging/homebrew/devvm.rb "$dir/SHA256SUMS" "https://github.com/devvmhq/devvm/releases/download/v$v" dist || die "couldn't write the formulas" for n in "${names[@]}"; do echo "==> dist/$n.rb for devvm $v, from $dir/SHA256SUMS"; done exit 0 ;; --ci) [[ $# == 3 ]] || die "--ci needs a tag and a folder: --ci v DIR" ci "$2" "$3" exit 0 ;; --ci-sign) [[ $# == 3 ]] || die "--ci-sign needs a tag and a folder: --ci-sign v DIR" ci_sign "$2" "$3" exit 0 ;; --check-tag) check=true tagonly=true unsigned=true ;; --sign-legacy) [[ $# == 2 ]] || die "--sign-legacy needs one folder" sign_legacy "$2" exit 0 ;; "") ;; *) die "unknown argument '$1' (--head, --commit COMMIT, --tag TAG, --check, --check-tag, --formula-from DIR, --ci TAG DIR, --ci-sign TAG DIR, --sign-legacy DIR)" ;; esac if [[ -z ${ref:-} ]]; then version_file; ref=v$v; fi if $snapshot; then commit=$(git rev-parse -q --verify --end-of-options "$ref^{commit}") || die "no commit $ref" v=$(git show "$commit:VERSION" 2>/dev/null | tr -d '[:space:]') || true valid_version "$v" || die "VERSION isn't x.y.z or x.y.z-rc.N: '$v'" else obj=$(git rev-parse -q --verify "refs/tags/$ref") || die "no tag $ref: tag the release first (git tag -s $ref)" # A release comes from a tag the maintainer signed, not just any tag with the right name. The tag # object checked is the one built from: its commit is resolved once, and used for everything below. git verify-tag "$obj" >/dev/null 2>&1 || die "tag $ref isn't signed by a key git trusts (make it with git tag -s; see docs/content/docs/contributing/maintaining.md)" # And by the release signer, not just any key git trusts: its fingerprint is pinned in this # checkout's packaging/release-signer (one per line; # comments), never the tagged commit's, which # the tag brings. signers=$root/packaging/release-signer [[ -s $signers ]] || die "no packaging/release-signer: write the tag-signing key's fingerprint there (see docs/content/docs/contributing/maintaining.md)" raw=$(git verify-tag --raw "$obj" 2>&1) || true # GPG: VALIDSIG … ; SSH: "… key SHA256:…". fps=$(awk '$1 == "[GNUPG:]" && $2 == "VALIDSIG" { print $3; print $NF }' <<<"$raw" grep -oE 'SHA256:[A-Za-z0-9+/]{43}' <<<"$raw" || true) fps=$(sort -u <<<"$fps") ok=false while IFS= read -r fp; do [[ -n $fp ]] && grep -v '^#' "$signers" | tr -d ' \t' | grep -xiF "$fp" >/dev/null && ok=true done <<<"$fps" $ok || die "tag $ref is signed by $(paste -sd' ' - <<<"$fps"), not a key in packaging/release-signer" commit=$(git rev-parse -q --verify "$obj^{commit}") || die "no commit for $ref" [[ "$(git show "$commit:VERSION" | tr -d '[:space:]')" == "$v" ]] || die "$ref's VERSION isn't $v" fi pubkey=$(git show "$commit:packaging/minisign.pub" 2>/dev/null | sed -n 2p) || true # A test key's public key, for a snapshot only: a release verifies with the committed one. if $snapshot && [[ -n ${DEVVM_MINISIGN_PUB:-} ]]; then pubkey=$(sed -n 2p "$DEVVM_MINISIGN_PUB") || die "can't read $DEVVM_MINISIGN_PUB" fi key=${DEVVM_MINISIGN_KEY:-$HOME/.minisign/devvm.key} sign=true if $unsigned || { $snapshot && [[ -z ${DEVVM_MINISIGN_KEY:-} ]]; }; then sign=false; fi # A release's install.sh trusts the committed key, signed or not (--tag). if $sign || ! $snapshot; then [[ -n $pubkey ]] || die "no packaging/minisign.pub in $ref: create the release key first (see docs/content/docs/contributing/maintaining.md)" fi if $sign; then [[ -f $key ]] || die "no release key at $key (DEVVM_MINISIGN_KEY)" command -v minisign >/dev/null || die "needs minisign to sign the release (mise exec -- scripts/release.sh)" fi git cat-file -e "$commit:install.sh" 2>/dev/null || die "no install.sh in $ref" # The release keys, none or all three, none a placeholder (placeholder, above), and install.sh's # lines the same. if ! $snapshot; then keys=" " have=0 missing= script=$(git show "$commit:install.sh") || die "couldn't read $ref's install.sh" for r in ci cosign recovery; do if git cat-file -e "$commit:packaging/keys/release-$r.pub" 2>/dev/null; then have=$((have + 1)) else missing+=", release-$r.pub" fi done if ((have > 0 && have < 3)); then die "$ref has $have of the 3 release keys in packaging/keys, which a devvm can't upgrade with: add ${missing#, } (see docs/content/docs/contributing/maintaining.md)" fi for r in ci cosign recovery; do f=packaging/keys/release-$r.pub line=$(grep -E "^release_${r}_key=" <<<"$script" || true) if ((have == 0)); then # No release keys: install.sh trusts none either. [[ -z $line || $line == "release_${r}_key=" ]] || die "$ref's install.sh has $line, but packaging/keys has no release keys: add them all, or empty its line" continue fi pub=$(git show "$commit:$f") || die "couldn't read $ref's $f" k=$(sed -n 2p <<<"$pub") [[ $k =~ ^RW[A-Za-z0-9+/]{54}$ ]] || die "$ref's $f holds no minisign public key on its second line" ! placeholder "$pub" || die "$ref's $f is a placeholder key: make the real release keys first (docs/content/docs/contributing/github-setup.md, step 1)" [[ $keys != *" $k "* ]] || die "$ref's $f is another role's key: each role needs a key of its own" [[ -z $pubkey || $k != "$pubkey" ]] || die "$ref's $f is the old release key, packaging/minisign.pub's: each role needs a key of its own" keys+="$k " [[ $line == "release_${r}_key=$k" ]] || die "$ref's install.sh has ${line:-no release_${r}_key=}, not $f's key" done fi if $tagonly; then echo "$commit"; exit 0; fi # The container image is the built commit's, as its build is (the header says why), pinned by its # digest. A commit from before reproducible builds names none, and builds with its own release.sh. image=$(git show "$commit:scripts/release.sh" 2>/dev/null | sed -n 's/^release_image=//p') || true [[ $image =~ ^docker\.io/[a-z0-9._/-]+:[A-Za-z0-9._-]+@sha256:[0-9a-f]{64}$ ]] || die "$ref's scripts/release.sh pins no release_image by digest, so it's from before reproducible builds: build it with its own scripts/release.sh" # The container runtime: DEVVM_RELEASE_RUNTIME's, else podman, else Docker. runtime=${DEVVM_RELEASE_RUNTIME:-} if [[ -z $runtime ]]; then for r in podman docker; do command -v "$r" >/dev/null && { runtime=$r; break; }; done fi if [[ -z $runtime ]] || ! command -v "$runtime" >/dev/null; then die "needs podman or Docker to build in its container (DEVVM_RELEASE_RUNTIME names one)" fi # The user the container runs as, so that what it writes in the work folder is yours: root under a # rootless runtime (podman's default, and Docker's rootless mode), which maps root to you, and you # under a rootful one (Docker, Docker Desktop). The runtime says which: podman in its info's # Host.Security.Rootless, as does podman behind a docker command (podman-docker), and Docker by # listing rootless in its security options. Its name doesn't. rootless= if ver=$("$runtime" --version 2>/dev/null) && [[ $ver == podman* ]]; then rootless=$("$runtime" info --format '{{.Host.Security.Rootless}}' 2>/dev/null) || rootless= elif so=$("$runtime" info --format '{{json .SecurityOptions}}' 2>/dev/null); then rootless=false [[ $so != *name=rootless* ]] || rootless=true fi case $rootless in true) user=0:0 ;; false) user=$(id -u):$(id -g) ;; *) die "$runtime didn't say whether it's rootless: is it running? ($runtime info)" ;; esac command -v curl >/dev/null || die "needs curl to download Go and GoReleaser" if $check; then echo "$commit"; exit 0; fi url=${DEVVM_RELEASE_URL:-https://github.com/devvmhq/devvm/releases/download/v$v} out=$root/dist if [[ -n ${DEVVM_RELEASE_DIST:-} ]]; then out=$DEVVM_RELEASE_DIST [[ $out == /* && ! -e $out && ! -L $out ]] || die "DEVVM_RELEASE_DIST isn't an absolute path that doesn't exist yet: '$out'" fi # An unsigned build, such as --tag's, never replaces a signed one's files, and a test build, signed # with a test key, never replaces a build signed with the release key, this checkout's # packaging/minisign.pub. if ! $sign && [[ -z ${DEVVM_RELEASE_DIST:-} && -e $out/SHA256SUMS.minisig ]]; then die "dist/ holds a signed build, which this unsigned one would replace: move it first, or set DEVVM_RELEASE_DIST to a new folder" fi if $sign && $snapshot && [[ -z ${DEVVM_RELEASE_DIST:-} && -e $out/SHA256SUMS.minisig && -f $root/packaging/minisign.pub ]] && minisign -Vm "$out/SHA256SUMS" -x "$out/SHA256SUMS.minisig" -p "$root/packaging/minisign.pub" >/dev/null 2>&1; then die "dist/ holds a build signed with the release key (packaging/minisign.pub), which this test build would replace: move it first, or set DEVVM_RELEASE_DIST to a new folder" fi src=${DEVVM_RELEASE_SRC:-$root} [[ $src == /* ]] || die "DEVVM_RELEASE_SRC isn't an absolute path: '$src'" limit=${DEVVM_RELEASE_TIMEOUT:-7200} [[ $limit =~ ^[1-9][0-9]{0,5}$ ]] || die "DEVVM_RELEASE_TIMEOUT isn't a number of seconds: '$limit'" # The container runs this system's processor, and gets that platform's Go and GoReleaser from the # commit's mise.lock: its URL, and its SHA-256, which every copy is checked against before it's used. case $(uname -m) in arm64 | aarch64) arch=arm64 platform=linux-arm64 ;; x86_64 | amd64) arch=amd64 platform=linux-x64 ;; *) die "no release container for $(uname -m)" ;; esac lock=$(git show "$commit:mise.lock" 2>/dev/null) || die "no mise.lock in $ref" [[ -f $root/mise.lock ]] || die "no mise.lock in this checkout" # The commit's go.mod needs a Go no newer than this checkout's, which downloads its modules (below). modgo=$(git show "$commit:go.mod" 2>/dev/null | sed -n 's/^go[[:space:]]\{1,\}\([0-9][0-9a-z.]*\).*/\1/p' | head -1) || true tmp=$(mktemp -d "${TMPDIR:-/tmp}/devvm-release.XXXXXX") # The container running now (contained, below): its name, its client's pid and its watchdog's. live='' live_pid='' live_wd='' # stop NAME PID: the container NAME removed, running or not, and its client, PID, ended: given 5 # seconds to exit as its container goes, then killed. Then the container's removed again, in case # the client was creating it. stop() { local i=0 "$runtime" rm -f "$1" >/dev/null 2>&1 || true if [[ -n $2 ]]; then while kill -0 "$2" 2>/dev/null && (( i++ < 50 )); do sleep 0.1; done kill -9 "$2" 2>/dev/null || true fi "$runtime" rm -f "$1" >/dev/null 2>&1 || true } # However this script ends, the running container is removed, and the temp folder (chmod first: a # folder the container left without write permission would keep rm from emptying it). Ctrl+C, a # closed terminal and kill end it through the EXIT trap, at once, as the client runs in the # background (contained). kill -9 runs no trap: the watchdog does the same. trap 'if [[ -n $live ]]; then echo "release: stopping the container $live" >&2 [[ -z $live_wd ]] || kill "$live_wd" 2>/dev/null || true stop "$live" "$live_pid" fi chmod -R u+rwx "$tmp" 2>/dev/null; rm -rf "$tmp"' EXIT trap 'exit 130' INT trap 'exit 129' HUP trap 'exit 143' TERM work=$tmp/work mkdir -p "$work/dl" cache=${XDG_CACHE_HOME:-$HOME/.cache}/devvm-release # fetch LOCK WHOSE TOOL DEST: TOOL's download for this platform, as LOCK, WHOSE mise.lock (HEAD's, # this checkout's), pins it, into DEST, checked; tool_version: its version there. fetch() { local lock=$1 whose=$2 tool=$3 dest=$4 n m dl sum from proto files # The tool's one [[tools.TOOL]] entry, its version, and its one [tools.TOOL."platforms.PLATFORM"] # table: its url and checksum. A lock with two of either (two versions, or a merge gone wrong) is # refused, rather than read for whichever comes last. read -r n m dl sum tool_version < <(awk -v e="[[tools.$tool]]" -v t="[tools.$tool.\"platforms.$platform\"]" ' $0 == e { n++; g = 1; s = 0; next } $0 == t { m++; s = 1; g = 0; next } /^\[/ { s = 0; g = 0 } g && $1 == "version" { ver = $3 } s && $1 == "url" { u = $3 } s && $1 == "checksum" { c = $3 } END { gsub(/"/, "", u); gsub(/"/, "", c); gsub(/"/, "", ver); sub(/^sha256:/, "", c); print n + 0, m + 0, u, c, ver }' <<<"$lock") || true (( n <= 1 )) || die "$whose mise.lock has $n $tool entries, not one" (( m <= 1 )) || die "$whose mise.lock has $m $tool downloads for $platform, not one" [[ $n == 1 && -n $dl && $sum =~ ^[0-9a-f]{64}$ ]] || die "$whose mise.lock has no $tool download for $platform" # The download comes only from the tool's own publisher, over https, and goes to curl as --url's # value, so nothing in the lock can be read as one of curl's options. No %, which curl would # decode, so .. can't hide in it. file:// is for the tests, and only from the one folder they name, # which has to exist and not be /, so the switch set by mistake reads nothing else of yours. case $tool in go) from=https://dl.google.com/go/ ;; *) from=https://github.com/goreleaser/goreleaser/releases/download/ ;; esac proto='=https' files=${DEVVM_RELEASE_TEST_FILE_URLS:-} if [[ $files == /* && -d $files && $(cd -P "$files" && pwd) != / ]]; then from=file://$files/ proto='=file'; fi if [[ $dl != "$from"* || $dl == *..* || ! $dl =~ ^[A-Za-z0-9:/._~+-]+$ ]]; then die "$whose mise.lock downloads $tool from '$dl', not $from" fi if [[ ! -f $cache/$sum ]]; then mkdir -p "$cache" curl -fsSL --retry 3 --proto "$proto" --proto-redir =https --connect-timeout 30 --max-time 900 \ --max-filesize $((1 << 30)) -o "$cache/$sum.part" --url "$dl" || die "couldn't download $dl" mv "$cache/$sum.part" "$cache/$sum" fi cp "$cache/$sum" "$dest" [[ $(sha256 "$dest") == "$sum" ]] || { rm -f "$cache/$sum"; die "$dl doesn't match $whose mise.lock (sha256:$sum)"; } } # newer A B: whether Go version A (1.22, 1.22.3, 1.23rc1) is newer than B, number by number. newer() { awk -v a="$1" -v b="$2" 'BEGIN { na = split(a, x, "."); nb = split(b, y, ".") for (i = 1; i <= (na > nb ? na : nb); i++) if (x[i] + 0 != y[i] + 0) exit !(x[i] + 0 > y[i] + 0) exit 1 }' } fetch "$lock" "$ref's" go "$work/dl/go.tar.gz" fetch "$lock" "$ref's" goreleaser "$work/dl/goreleaser.tar.gz" # The modules' Go is this checkout's, so the container with the network runs nothing the commit # chose. go.sum pins the module files, so they're the same whichever Go downloads them. fetch "$(cat "$root/mise.lock")" "this checkout's" go "$tmp/checkout-go.tar.gz" [[ -n $tool_version ]] || die "this checkout's mise.lock has no go version" if [[ -n $modgo ]] && newer "$modgo" "$tool_version"; then die "$ref's go.mod needs Go $modgo, newer than the $tool_version this checkout's mise.lock pins: build it from a checkout at least as new" fi # GoReleaser builds the commit in a repository of the build's own, so only what's committed goes # in, whatever this checkout holds. The version is the commit's VERSION (DEVVM_VERSION, in # .goreleaser.yaml's snapshot too). The repository holds the commit and, for a tag, the tag, fetched # into a pack: none of this one's other branches, tags or objects, which the container would see, # and no files shared with it, as a local clone's hardlinks would be, which the container could # write. No tag but the one built from, too, because Go stamps the binary with a version from the # tags it finds, and every builder holds different ones. It starts with no hooks (--template=). Its # origin is devvm's repository on GitHub, which GoReleaser reads but nothing fetches from: without # one, GoReleaser refuses a release and builds a snapshot with no commit. { git -c init.defaultBranch=build init -q --template= "$work/src" && git -C "$work/src" -c protocol.version=2 fetch -q --no-tags --update-shallow "$src" "$commit" && git -C "$work/src" cat-file -e "$commit^{commit}" && git -C "$work/src" remote add origin https://github.com/devvmhq/devvm.git; } || die "couldn't fetch $commit from $src" if ! $snapshot; then git -C "$work/src" fetch -q --no-tags "$src" "refs/tags/$ref:refs/tags/$ref" || die "couldn't fetch the tag $ref" [[ $(git -C "$work/src" rev-parse "refs/tags/$ref") == "$obj" ]] || die "the tag $ref changed during the build" fi git show "$commit:scripts/release.sh" > "$work/release.sh" || die "no scripts/release.sh in $ref" # contained WHAT ARGS…: "$runtime" run ARGS, named for this run alone (its temp folder's suffix, so # no other run's container, even one left over, has the name), and removed from here, whatever its # image does: the image's own timeout could be anything. A watchdog removes it once it has run for # the time limit, or as soon as this script is gone, even by kill -9, and then the temp folder too. # The client runs in the background, so Ctrl+C, which it then ignores, and kill run this script's # traps at once: in the foreground, bash would wait for the client, and the client for the # container's first process, bash as its PID 1, which ignores them. WHAT, in a failure's message, is # what it ran. n=0 contained() { local what=$1 name rc=0 shift n=$((n + 1)) name=devvm-release-${tmp##*.}-$n live=$name "$runtime" run --name "$name" "$@" & live_pid=$! ( trap '' INT HUP i=0 while (( i < limit )); do sleep 1 if ! kill -0 "$$" 2>/dev/null; then stop "$name" "$live_pid" chmod -R u+rwx "$tmp" 2>/dev/null; rm -rf "$tmp" exit 0 fi i=$((i + 1)) done : > "$tmp/$name.late" stop "$name" "$live_pid" ) >/dev/null 2>&1 & live_wd=$! wait "$live_pid" || rc=$? kill "$live_wd" 2>/dev/null || true wait "$live_wd" 2>/dev/null || true live='' live_pid='' live_wd='' [[ ! -e $tmp/$name.late ]] || die "$what ran for $limit seconds, the limit (DEVVM_RELEASE_TIMEOUT), so it was stopped" (( rc == 0 )) || die "$what failed" } # Every container: no capabilities, so root in it can't take a file's owner or bypass its mode, no # new privileges, so a setuid file in the image gives none, at most 8192 processes and 8 GiB of # memory, so a build under a rootful runtime can't use up the machine's, and bash as its first # process, so the image's own entrypoint never runs. base=(--rm --platform "linux/$arch" --user "$user" --security-opt no-new-privileges --cap-drop ALL --pids-limit 8192 --memory 8g --entrypoint bash) # The Go modules the commit's go.mod needs, downloaded first, the only step with the network: in this # checkout's release_image, by this checkout's release.sh (modules) and Go, from go.mod and go.sum # alone. in=$tmp/in mods=$tmp/mod o=$tmp/out mkdir "$in" "$mods" "$o" git show "$commit:go.mod" > "$in/go.mod" 2>/dev/null || die "no go.mod in $ref" git show "$commit:go.sum" > "$in/go.sum" 2>/dev/null || : > "$in/go.sum" mv "$tmp/checkout-go.tar.gz" "$in/go.tar.gz" cp "$root/scripts/release.sh" "$in/release.sh" echo "==> downloading $ref's Go modules in $release_image, under $runtime as $user" contained "the modules' download in $release_image" "${base[@]}" -v "$in:/in:ro,z" -v "$mods:/out:z" -w /in \ "$release_image" /in/release.sh _modules /in /out # The build, with no network, the modules read-only, and its files written to a folder of their own, # /out, which the container can't swap for a link, as a mount point can't be renamed. opts=("${base[@]}" --network none -v "$work:/work:z" -v "$mods:/mod:ro,z" -v "$o:/out:z" -w /work) $snapshot || opts+=(-e "GORELEASER_CURRENT_TAG=$ref") # An unsigned snapshot is a test build, whose install.sh expects no signature; --tag's is the release's. if $snapshot && ! $sign; then pubkey=""; fi echo "==> building $commit in $image, under $runtime as $user" contained "the build in $image" "${opts[@]}" "$image" /work/release.sh _build "$v" "$commit" "$url" "$pubkey" /mod /out # What the container wrote is checked before anything here reads it, and copied, never moved: the # folder is still the one this script made, every path in it is a file or a folder, never a link, # which minisign, publish.sh and gh would follow to a file of yours, and each is yours, and neither # setuid, setgid, sticky nor writable by anyone. The copies are yours, 0755 or 0644. [[ -d $o && ! -L $o && $(cd -P "$o" && pwd) == "$(cd -P "$tmp" && pwd)/out" ]] || die "the build's output folder isn't the one it was given: nothing is signed or kept" [[ -f $o/SHA256SUMS && ! -L $o/SHA256SUMS ]] || die "the build left no SHA256SUMS: nothing is signed or kept" bad=$(find "$o" -mindepth 1 ! -type f ! -type d -print -quit) || die "couldn't read the build's files" [[ -z $bad ]] || die "the build left ${bad#"$o/"}, which isn't a file or a folder: nothing is signed or kept" bad=$(find "$o" -mindepth 1 \( ! -user "$(id -u)" -o -perm -4000 -o -perm -2000 -o -perm -1000 -o -perm -0002 \) -print -quit) || die "couldn't read the build's files" [[ -z $bad ]] || die "the build left ${bad#"$o/"}, which isn't yours, or is setuid, setgid, sticky or writable by anyone: nothing is signed or kept" # And no more than 2 GiB, which a release is far under, so the copy can't fill dist/'s disk: counted # as read, sparse files whole, and read no further than the limit. cap=$((2 << 30)) size=$({ find "$o" -type f -exec cat {} + 2>/dev/null || true; } | head -c $((cap + 1)) | wc -c | tr -d ' ') (( size <= cap )) || die "the build left more than 2 GiB of files: nothing is signed or kept" [[ -n ${DEVVM_RELEASE_DIST:-} ]] || rm -rf "$out" mkdir "$out" { cp -R "$o/." "$out/" && chmod -R u=rwX,go=rX "$out"; } || die "couldn't copy the build's files to $out" if $sign; then minisign -Sm "$out/SHA256SUMS" -s "$key" -t "devvm $v" || die "couldn't sign SHA256SUMS" minisign -Vm "$out/SHA256SUMS" -P "$pubkey" >/dev/null || die "SHA256SUMS.minisig doesn't verify with packaging/minisign.pub" fi echo "==> ${DEVVM_RELEASE_DIST:-dist}/ for devvm $v (from $ref):" (cd "$out" && ls -l devvm-*.tar.gz SHA256SUMS* install.sh devvm*.rb 2>/dev/null) || true if $unsigned; then echo "(not signed: --tag builds the release without its signature)" elif ! $sign; then echo "(not signed: a test build without DEVVM_MINISIGN_KEY)"; fi # --tag's build, CI's among them, is the co-signer's to publish; the rest, publish.sh --local's. if $unsigned; then : elif [[ $v == *-* ]]; then echo "scripts/publish.sh --local publishes them: the archives, SHA256SUMS, SHA256SUMS.minisig and install.sh to the GitHub prerelease v$v, devvm-rc.rb to devvmhq/homebrew-tap's Formula/; the formula devvm keeps the last release." else echo "scripts/publish.sh --local publishes them: the archives, SHA256SUMS, SHA256SUMS.minisig and install.sh to the GitHub release v$v, devvm.rb to devvmhq/homebrew-tap's Formula/, and devvm-rc.rb too when the tap's devvm-rc is older." fi