1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-16 10:35:31 +01:00
bitwarden-desktop/scripts/cask-update.sh

31 lines
857 B
Bash
Raw Normal View History

2018-02-20 04:52:12 +01:00
#!/usr/bin/env bash
set -e
# dependencies:
2018-02-20 04:50:16 +01:00
# brew install jq
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ROOT_DIR="$DIR/.."
DIST_DIR="$ROOT_DIR/dist"
CASK_DIR="$ROOT_DIR/stores/homebrew-cask"
DIST_CASK_DIR="$DIST_DIR/homebrew-cask"
2018-02-20 05:33:43 +01:00
if [ -d "$DIST_CASK_DIR" ]
2018-02-20 04:50:16 +01:00
then
rm -rf $DIST_CASK_DIR
fi
2018-02-20 05:33:43 +01:00
cp -r $CASK_DIR $DIST_DIR
2018-02-20 04:50:16 +01:00
SRC_PACKAGE="$ROOT_DIR/src/package.json";
2018-02-20 05:33:43 +01:00
SRC_PACAKGE_VERSION=$(jq -r '.version' $SRC_PACKAGE)
2018-02-20 04:50:16 +01:00
2018-02-20 05:33:43 +01:00
ZIP="$DIST_DIR/Bitwarden-$SRC_PACAKGE_VERSION-mac.zip"
CHECKSUM=($(shasum -a 256 $ZIP))
CHECKPOINT=$(brew cask _appcast_checkpoint --calculate "https://github.com/bitwarden/desktop/releases.atom")
2018-02-20 04:50:16 +01:00
RB="$DIST_CASK_DIR/bitwarden.rb"
2018-02-20 05:33:43 +01:00
RB_NEW="$DIST_CASK_DIR/bitwarden.rb.new"
2018-02-20 04:50:16 +01:00
2018-02-20 05:33:43 +01:00
sed -e 's/__version__/'"$SRC_PACAKGE_VERSION"'/g; s/__checksum__/'"$CHECKSUM"'/g; s/__checkpoint__/'"$CHECKPOINT"'/g' $RB > $RB_NEW
mv -f $RB_NEW $RB