Add additionla step to build, that creates the homebrew file.

This commit is contained in:
Marcel Schramm 2019-06-13 13:36:17 +02:00
parent ab9bdb2ca5
commit 454f707580
No known key found for this signature in database
GPG Key ID: 05971054C70EEDC7
2 changed files with 38 additions and 1 deletions

25
cordless.rb_template Normal file
View File

@ -0,0 +1,25 @@
class Cordless < Formula
desc "Discord, but in 1984"
homepage "https://github.com/Bios-Marcel/cordless"
url "https://github.com/Bios-Marcel/cordless/archive/$RELEASE_DATE.tar.gz"
version "$RELEASE_DATE"
sha256 "$TAR_HASH"
head "https://github.com/Bios-Marcel/cordless.git"
depends_on "go" => :build
depends_on "pngpaste" => :recommended
def install
ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache"
(buildpath/"src/github.com/Bios-Marcel/cordless").install buildpath.children
cd "src/github.com/Bios-Marcel/cordless" do
system "go", "build", "-o", bin/"cordless"
prefix.install_metafiles
end
end
test do
system "true"
end
end

View File

@ -128,10 +128,22 @@ else
hub release create -a "$BIN_LINUX" -a "$BIN_DARWIN" -a "$BIN_WINDOWS" -m "${RELEASE_DATE}" -m "${RELEASE_BODY}" "$RELEASE_DATE"
fi
#
# Substitutes the manifest template for the homebrew package. We need to
# download the latets tarball in order to get its sha256 sum.
#
rm cordless.rb
wget https://github.com/Bios-Marcel/cordless/archive/$RELEASE_DATE.tar.gz
TAR_HASH="$(sha256sum ./$RELEASE_DATE.tar.gz | cut -f 1 -d " ")"
export TAR_HASH
rm ./$RELEASE_DATE.tar.gz
envsubst < cordless.rb_template > cordless.rb
#
# Unsetting(and unexporting) previously exported environment variables.
#
unset RELEASE_DATE
unset EXE_HASH
unset EXE_HASH
unset TAR_HASH