-
Notifications
You must be signed in to change notification settings - Fork 42
/
.deploy-to-homebrew
executable file
·44 lines (38 loc) · 1.73 KB
/
.deploy-to-homebrew
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash -e
if [ "$GITHUB_TOKEN" == "" ]; then echo "\$GITHUB_TOKEN isn't set"; exit 1; fi
if [ "$VERSION" == "" ]; then echo "\$VERSION isn't set"; exit 1; fi
ARCHIVE=$(mktemp /tmp/kubesec.XXXXXX)
curl -sSL https://github.com/shyiko/kubesec/archive/$VERSION.tar.gz -o $ARCHIVE
if ! tar xOf $ARCHIVE &> /dev/null; then echo "$ARCHIVE isn't a valid archive"; exit 1; fi
HASH=$(shasum -a 256 $ARCHIVE | cut -d\ -f1)
CHECKOUT_DIR=$(mktemp -d /tmp/homebrew-kubesec.XXXXXX)
git clone https://${GITHUB_TOKEN}@github.com/shyiko/homebrew-kubesec.git $CHECKOUT_DIR
{
echo "class Kubesec < Formula"
echo " desc \"Secure Secret management for Kubernetes (with gpg, Google Cloud KMS and AWS KMS backends)\""
echo " homepage \"https://github.com/shyiko/kubesec\""
echo " url \"https://github.com/shyiko/kubesec/archive/$VERSION.tar.gz\""
echo " sha256 \"$HASH\""
echo " head \"https://github.com/shyiko/kubesec.git\""
echo " version \"$VERSION\""
echo " depends_on \"go\" => :build"
echo ""
echo " option \"with-short-name\", \"link as ksec instead\""
echo ""
echo " def install"
echo " ENV[\"GOPATH\"] = buildpath"
echo " ENV[\"PATH\"] = \"#{ENV[\"PATH\"]}:#{ENV[\"GOPATH\"]}/bin\""
echo " (buildpath/\"src/github.com/shyiko/kubesec\").install buildpath.children"
echo " cd \"src/github.com/shyiko/kubesec\" do"
echo " system \"make\", \"fetch\""
echo " system \"make\", \"build\""
echo " bin.install \"kubesec\" => build.with?(\"short-name\") ? \"ksec\" : \"kubesec\""
echo " end"
echo " end"
echo ""
echo " test do"
echo " system bin/\"kubesec\", \"--version\""
echo " end"
echo "end"
} > $CHECKOUT_DIR/kubesec.rb
(cd $CHECKOUT_DIR && git commit -m $VERSION kubesec.rb && git tag $VERSION && git push origin master --tags)