Skip to content

Commit 5a47777

Browse files
authored
Merge pull request #1642 from r2d4/arch-cask-autoupdate
Automate updates to AUR and brew-cask
2 parents b5fd843 + a367be0 commit 5a47777

File tree

4 files changed

+100
-5
lines changed

4 files changed

+100
-5
lines changed
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
cask 'minikube' do
2+
version '$PKG_VERSION'
3+
sha256 '$MINIKUBE_DARWIN_SHA256'
4+
5+
# storage.googleapis.com/minikube was verified as official when first introduced to the cask
6+
url "https://storage.googleapis.com/minikube/releases/v#{version}/minikube-darwin-amd64"
7+
appcast 'https://github.com/kubernetes/minikube/releases.atom',
8+
checkpoint: '$CASK_CHECKPOINT'
9+
name 'Minikube'
10+
homepage 'https://github.com/kubernetes/minikube'
11+
12+
depends_on formula: 'kubernetes-cli'
13+
container type: :naked
14+
15+
binary 'minikube-darwin-amd64', target: 'minikube'
16+
17+
zap delete: '~/.minikube'
18+
end

installers/linux/archlinux/.SRCINFO

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pkgbase = minikube
22
pkgdesc = Minikube is a tool that makes it easy to run Kubernetes locally
3-
pkgver = 0.18.0
3+
pkgver = $PKG_VERSION
44
pkgrel = 1
55
url = https://github.com/kubernetes/minikube
66
arch = x86_64
@@ -9,8 +9,8 @@ pkgbase = minikube
99
optdepends = kubectl-bin: to manage the cluster
1010
optdepends = virtualbox
1111
optdepends = docker-machine-kvm
12-
source = minikube_0.17.1::https://storage.googleapis.com/minikube/releases/v0.17.1/minikube-linux-amd64
13-
sha256sums = c1dd2eb704ec29000d2c6080ca18660b862eedf0eb1c933aed746e93e6e5adea
12+
source = minikube_$PKG_VERSION::https://storage.googleapis.com/minikube/releases/v$PKG_VERSION/minikube-linux-amd64
13+
sha256sums = $MINIKUBE_LINUX_SHA256
1414

1515
pkgname = minikube
1616

installers/linux/archlinux/PKGBUILD

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Maintainer: Matt Rickard <[email protected]>
33

44
pkgname=minikube
5-
pkgver=0.18.0
5+
pkgver=$PKG_VERSION
66
pkgrel=1
77
pkgdesc="Minikube is a tool that makes it easy to run Kubernetes locally"
88
url="https://github.com/kubernetes/minikube"
@@ -19,7 +19,7 @@ optdepends=(
1919
makedepends=()
2020

2121
source=(minikube_$pkgver::https://storage.googleapis.com/minikube/releases/v$pkgver/minikube-linux-amd64)
22-
sha256sums=('c1dd2eb704ec29000d2c6080ca18660b862eedf0eb1c933aed746e93e6e5adea')
22+
sha256sums=('$MINIKUBE_LINUX_SHA256')
2323
package() {
2424
cd "$srcdir"
2525
install -d "$pkgdir/usr/bin"

0 commit comments

Comments
 (0)