|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2016 The Kubernetes Authors All rights reserved. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +git config user.name "minikube-bot" |
| 18 | +git config user.email "[email protected]" |
| 19 | + |
| 20 | +REPLACE_PKG_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD} |
| 21 | +REPLACE_MINIKUBE_LINUX_SHA256=$(awk '{ print $1 }' out/minikube-linux-amd64.sha256) |
| 22 | +REPLACE_MINIKUBE_DARWIN_SHA256=$(awk '{ print $1 }' out/minikube-darwin-amd64.sha256) |
| 23 | +REPLACE_CASK_CHECKPOINT=$(curl \ |
| 24 | + --compressed \ |
| 25 | + --location \ |
| 26 | + --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36' \ |
| 27 | + https://github.com/kubernetes/minikube/releases.atom \ |
| 28 | + | sed 's|<pubDate>[^<]*</pubDate>||g' \ |
| 29 | + | shasum -a 256 | awk '{ print $1 }') |
| 30 | +MINIKUBE_ROOT=$PWD |
| 31 | + |
| 32 | +GIT_SSH_COMMAND= 'ssh -i $ARCH_SSH_KEY' git clone ssh:// [email protected]/minikube.git aur-minikube |
| 33 | +pushd aur-minikube >/dev/null |
| 34 | + sed -e "s/\$PKG_VERSION/${REPLACE_PKG_VERSION}/g" \ |
| 35 | + -e "s/\$MINIKUBE_LINUX_SHA256/${REPLACE_MINIKUBE_LINUX_SHA256}/g" \ |
| 36 | + $MINIKUBE_ROOT/installers/linux/archlinux/PKGBUILD > PKGBUILD |
| 37 | + sed -e "s/\$PKG_VERSION/${REPLACE_PKG_VERSION}/g" \ |
| 38 | + -e "s/\$MINIKUBE_LINUX_SHA256/${REPLACE_MINIKUBE_LINUX_SHA256}/g" \ |
| 39 | + $MINIKUBE_ROOT/installers/linux/archlinux/.SRCINFO > .SRCINFO |
| 40 | + git add PKGBUILD .SRCINFO |
| 41 | + git commit -m "Upgrade to version ${REPLACE_PKG_VERSION}" |
| 42 | + |
| 43 | + GIT_SSH_COMMAND='ssh -i $ARCH_SSH_KEY' git push origin master |
| 44 | + |
| 45 | +popd >/dev/null |
| 46 | + |
| 47 | +git clone --depth 1 [email protected]:minikube-bot/homebrew-cask.git # dont't pull entire history |
| 48 | + |
| 49 | +pushd homebrew-cask >/dev/null |
| 50 | + git checkout -b ${REPLACE_PKG_VERSION} |
| 51 | + sed -e "s/\$PKG_VERSION/${REPLACE_PKG_VERSION}/g" \ |
| 52 | + -e "s/\$MINIKUBE_DARWIN_SHA256/${REPLACE_MINIKUBE_DARWIN_SHA256}/g" \ |
| 53 | + -e "s/\$CASK_CHECKPOINT/${REPLACE_CASK_CHECKPOINT}/g" \ |
| 54 | + $MINIKUBE_ROOT/installers/darwin/brew-cask/minikube.rb.tmpl > Casks/minikube.rb |
| 55 | + git add Casks/minikube.rb |
| 56 | + git commit -F- <<EOF |
| 57 | +Update minikube to ${REPLACE_PKG_VERSION} |
| 58 | +
|
| 59 | +- [x] brew cask audit --download {{cask_file}} is error-free. |
| 60 | +- [x] brew cask style --fix {{cask_file}} reports no offenses. |
| 61 | +- [x] The commit message includes the cask’s name and version. |
| 62 | +
|
| 63 | +EOF |
| 64 | + git push origin ${REPLACE_PKG_VERSION} |
| 65 | + curl -v -k -u minikube-bot:${BOT_PASSWORD} -X POST https://api.github.com/repos/caskroom/homebrew-cask/pulls \ |
| 66 | + -d @- <<EOF |
| 67 | +
|
| 68 | +{ |
| 69 | + "title": "Update minikube to ${REPLACE_PKG_VERSION}", |
| 70 | + "head": "minikube-bot:${REPLACE_PKG_VERSION}", |
| 71 | + "base": "master" |
| 72 | +} |
| 73 | +
|
| 74 | +EOF |
| 75 | +popd >/dev/null |
| 76 | + |
| 77 | +rm -rf aur-minikube homebrew-cask |
0 commit comments