github.com/tilt-dev/tilt@v0.33.15-0.20240515162809-0a22ed45d8a0/scripts/release-update-homebrew-core.sh (about)

     1  #!/bin/bash
     2  #
     3  # Updates the Tilt repo with the latest version info.
     4  #
     5  # Usage:
     6  # scripts/release-update-homebrew-core.sh $VERSION
     7  # where VERSION is of the form v0.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  # NOTE(nicks): homebrew started giving the error:
    17  # Error: No available formula with the name "tilt".
    18  # This env variable seems to be how people on the internet are fixing it.
    19  # https://github.com/orgs/Homebrew/discussions/4401
    20  export HOMEBREW_NO_INSTALL_FROM_API=1
    21  
    22  export HOMEBREW_GITHUB_API_TOKEN="$GITHUB_TOKEN"
    23  VERSION=${1//v/}
    24  VERSION_PATTERN="^[0-9]+\\.[0-9]+\\.[0-9]+$"
    25  if ! [[ $VERSION =~ $VERSION_PATTERN ]]; then
    26      echo "Version did not match expected pattern. Actual: $VERSION"
    27      exit 1
    28  fi
    29  
    30  # send the brew team a PR to upgrade homebrew-core
    31  brew bump-formula-pr --no-browse --force --version="$VERSION" tilt