Onset: version control where nobody waits and nothing gets lost. The on command, its core and onset-server.
| 1 | #!/usr/bin/env bash |
| 2 | # Puts a released version's Homebrew formula in the tap on Upstream |
| 3 | # (git.coline.app/coline/homebrew-tap), so `brew install coline/tap/onset` |
| 4 | # installs it. The release workflow publishes the formula next to the |
| 5 | # downloads; this copies it into the tap with your git credentials for |
| 6 | # git.coline.app (upstream auth setup-git). |
| 7 | # Usage: install/tap.sh <version> |
| 8 | set -euo pipefail |
| 9 | VERSION=$1 |
| 10 | BASE=${ONSET_DOWNLOADS:-https://downloads.coline.dev/onset} |
| 11 | TAP=${ONSET_TAP:-https://git.coline.app/coline/homebrew-tap.git} |
| 12 | DIR=$(mktemp -d) |
| 13 | trap 'rm -rf "$DIR"' EXIT |
| 14 | curl -fsSL "$BASE/$VERSION/onset.rb" -o "$DIR/onset.rb" |
| 15 | grep -q "version \"$VERSION\"" "$DIR/onset.rb" |
| 16 | git clone -q "$TAP" "$DIR/tap" |
| 17 | mkdir -p "$DIR/tap/Formula" |
| 18 | cp "$DIR/onset.rb" "$DIR/tap/Formula/onset.rb" |
| 19 | cat >"$DIR/tap/README.md" <<'EOF' |
| 20 | # Coline's Homebrew tap |
| 21 |
| 22 | ```sh |
| 23 | brew tap coline/tap https://git.coline.app/coline/homebrew-tap.git |
| 24 | brew install coline/tap/onset |
| 25 | ``` |
| 26 |
| 27 | `brew upgrade onset` picks up new releases. |
| 28 | EOF |
| 29 | cd "$DIR/tap" |
| 30 | git add Formula/onset.rb README.md |
| 31 | if git diff --cached --quiet; then |
| 32 | echo "the tap already has onset $VERSION" |
| 33 | exit 0 |
| 34 | fi |
| 35 | git -c user.name=Coline -c user.email=bot@coline.app commit -q -m "onset $VERSION" |
| 36 | git push -q origin HEAD:main |
| 37 | echo "the tap has onset $VERSION" |
| 38 |