forked from pinterest/ktlint
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.deploy-to-homebrew
executable file
·31 lines (24 loc) · 996 Bytes
/
.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
#!/bin/bash -e
# settings.servers.github.privateKey
if [ "$GITHUB_TOKEN" == "" ]; then exit 1; fi
# project.version
if [ "$VERSION" == "" ]; then exit 1; fi
if [ ! -f ktlint/target/ktlint ]; then echo "ktlint/target/ktlint wasn't found"; exit 1; fi
HASH=$(shasum -a 256 ktlint/target/ktlint | cut -d\ -f1)
CHECKOUT_DIR=$(mktemp -d /tmp/homebrew-ktlint.XXXXXX)
git clone https://${GITHUB_TOKEN}@github.com/shyiko/homebrew-ktlint.git $CHECKOUT_DIR
{
echo "class Ktlint < Formula"
echo " desc \"Kotlin linter\""
echo " homepage \"https://github.com/shyiko/ktlint\""
echo " url \"https://github.com/shyiko/ktlint/releases/download/$VERSION/ktlint\", :using => :nounzip"
echo " sha256 \"$HASH\""
echo " def install"
echo " bin.install \"ktlint\""
echo " end"
echo " test do"
echo " system bin/\"ktlint\", \"--version\""
echo " end"
echo "end"
} > $CHECKOUT_DIR/ktlint.rb
(cd $CHECKOUT_DIR && git commit -m $VERSION ktlint.rb && git tag $VERSION && git push origin master --tags)