未验证 提交 f4da94f6 编写于 作者: T Thomas Strömberg 提交者: GitHub

Merge pull request #6552 from tstromberg/homebrew-auto

Update script to use bump-formula-pr
......@@ -19,66 +19,39 @@
# VERSION_MAJOR
# VERSION_MINOR
# VERSION_BUILD
# BOT_PASSWORD
# access_token
set -eux -o pipefail
readonly REPO_DIR=$PWD
readonly NEW_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}
readonly NEW_SHA256=$(awk '{ print $1 }' "${REPO_DIR}/out/minikube-darwin-amd64.sha256")
readonly BUILD_DIR=$(mktemp -d)
readonly GITHUB_USER="minikube-bot"
readonly SRC_DIR=$(mktemp -d)
readonly TAG="v${NEW_VERSION}"
if ! [[ "${VERSION_BUILD}" =~ ^[0-9]+$ ]]; then
echo "NOTE: ${NEW_VERSION} appears to be a non-standard release, not updating releases.json"
echo "NOTE: ${NEW_VERSION} appears to be a non-standard release, not updating brew"
exit 0
fi
if [ -z "${NEW_SHA256}" ]; then
echo "SHA256 is empty :("
exit 1
fi
echo "***********************************************************************"
echo "Sorry, this script has not yet been updated to support non-cask updates"
echo "See https://github.com/kubernetes/minikube/issues/5779"
echo "***********************************************************************"
exit 99
git config --global user.name "${GITHUB_USER}"
git config --global user.email "${GITHUB_USER}@google.com"
cd "${BUILD_DIR}"
git clone --depth 1 "git@github.com:${GITHUB_USER}/homebrew-cask.git"
cd homebrew-cask
git remote add upstream https://github.com/Homebrew/homebrew-cask.git
git fetch upstream
git checkout upstream/master
git checkout -b "${NEW_VERSION}"
sed -e "s/\$PKG_VERSION/${NEW_VERSION}/g" \
-e "s/\$MINIKUBE_DARWIN_SHA256/${NEW_SHA256}/g" \
"${REPO_DIR}/installers/darwin/brew-cask/minikube.rb.tmpl" > Casks/minikube.rb
git add Casks/minikube.rb
git commit -F- <<EOF
Update minikube to ${NEW_VERSION}
- [x] brew cask audit --download {{cask_file}} is error-free.
- [x] brew cask style --fix {{cask_file}} reports no offenses.
- [x] The commit message includes the cask’s name and version.
cd "${SRC_DIR}"
git clone https://github.com/kubernetes/minikube
cd minikube
readonly revision=$(git rev-list -n1 "${TAG}")
EOF
# Required for the brew command
export HOMEBREW_GITHUB_API_TOKEN="${access_token}"
git push origin "${NEW_VERSION}"
curl -v -k -u "${GITHUB_USER}:${BOT_PASSWORD}" -X POST https://api.github.com/repos/Homebrew/homebrew-cask/pulls \
-d @- <<EOF
# brew installed as the Jenkins user using:
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)"
export PATH=/home/linuxbrew/.linuxbrew/bin:$PATH
{
"title": "Update minikube to ${NEW_VERSION}",
"head": "${GITHUB_USER}:${NEW_VERSION}",
"base": "master",
"body": "cc @balopat"
}
EOF
brew bump-formula-pr \
--strict minikube \
--revision="${revision}" \
--message="This PR was automatically created by minikube release scripts. Contact @tstromberg with any questions." \
--no-browse \
--tag="${TAG}" \
&& status=0 || status=$?
rm -Rf "${BUILD_DIR}"
rm -Rf "${SRC_DIR}"
exit $status
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册