Created
June 11, 2020 00:20
-
-
Save oppara/1a75961f5dfe53e511f4d42ab00e4579 to your computer and use it in GitHub Desktop.
cask update.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# https://github.com/rhysd/tweet-app/blob/master/Casks/update.sh | |
if [ ! -d '.git' ]; then | |
echo 'This script must be run at root of the repository' 2>&1 | |
exit 1 | |
fi | |
if [[ "$1" == "" ]]; then | |
echo 'Usage: update.sh {version}' 2>&1 | |
exit 1 | |
fi | |
cd ./Casks | |
VERSION="$1" | |
echo "Update formula to version ${VERSION}" | |
DMG="../dist/Tweet-${VERSION}.dmg" | |
if [ ! -f "$DMG" ]; then | |
echo "dist/Tweet-${VERSION}.dmg does not exist" 2>&1 | |
exit 1 | |
fi | |
SHA="$(shasum -a 256 "$DMG" | cut -f 1 -d ' ')" | |
echo "Mac sha256: ${SHA}" | |
sed -i '' -E "s/ sha256 '[0-9a-f]*'/ sha256 '${SHA}'/" tweet.rb | |
echo "Version: ${VERSION}" | |
sed -i '' -E "s/ version '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*'/ version '${VERSION}'/" tweet.rb | |
echo 'Done.' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment