Skip to content

Commit 23b7a3f

Browse files
authored
Add scripting for updating the Homebrew formula. (pulumi#3291)
This script will run during OS X legs, and will open a PR to update the Homebrew formula for Pulumi on each new release.
1 parent ecd0281 commit 23b7a3f

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ before_script:
2727
- "${PULUMI_SCRIPTS}/ci/ensure-dependencies"
2828
script:
2929
- make travis_${TRAVIS_EVENT_TYPE}
30+
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then ./scripts/update_homebrew.sh; fi
3031
after_failure:
3132
- "${PULUMI_SCRIPTS}/ci/upload-failed-tests"
3233
notifications:

scripts/update_homebrew.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
# update_homebrew.sh uses `brew bump-formula-pr` to update the formula for the Pulumi CLI and SDKs
3+
set -o nounset
4+
set -o errexit
5+
set -o pipefail
6+
readonly ROOT=$(dirname "${0}")/..
7+
8+
if [[ "${TRAVIS:-}" != "true" ]]; then
9+
echo "error: this script should be run from within Travis"
10+
exit 1
11+
fi
12+
13+
if [[ -z "${PULUMI_BOT_GITHUB_API_TOKEN:-}" ]]; then
14+
echo "error: PULUMI_BOT_GITHUB_API_TOKEN must be set"
15+
exit 1
16+
fi
17+
18+
if ! echo "${TRAVIS_TAG:-}" | grep -q -e "^v[0-9]\+\.[0-9]\+\.[0-9]\+$"; then
19+
echo "Skipping Homebrew formula update; ${TRAVIS_TAG:-} does not denote a released version"
20+
exit 0
21+
fi
22+
23+
if [[ "${TRAVIS_OS_NAME:-}" != "osx" ]]; then
24+
echo "Skipping Homebrew formula updte; not running on OS X"
25+
exit 0
26+
fi
27+
28+
HOMEBREW_GITHUB_API_TOKEN="${PULUMI_BOT_GITHUB_API_TOKEN:-}" brew bump-formula-pr --tag="${TRAVIS_TAG:-}" --revision="${TRAVIS_COMMIT:-}" pulumi
29+
exit 0

0 commit comments

Comments
 (0)