From 902d6de6db06f41a50c0f5949cd456defb9a5262 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 4 Jun 2018 15:24:37 -0400 Subject: [PATCH] scripts for cask and snap updates --- scripts/cask-update.ps1 | 16 ++++++++++++ scripts/cask-update.sh | 55 ---------------------------------------- scripts/snap-release.ps1 | 9 +++++++ 3 files changed, 25 insertions(+), 55 deletions(-) create mode 100644 scripts/cask-update.ps1 delete mode 100644 scripts/cask-update.sh create mode 100644 scripts/snap-release.ps1 diff --git a/scripts/cask-update.ps1 b/scripts/cask-update.ps1 new file mode 100644 index 0000000000..88fa198c42 --- /dev/null +++ b/scripts/cask-update.ps1 @@ -0,0 +1,16 @@ +param ( + [string] $version = "" +) + +# Dependencies: +# 1. brew cask install powershell +# 2. brew install vitorgalvao/tiny-scripts/cask-repair +# see https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#updating-a-cask +# 3. fork of homebrew-cask repo setup. +# see https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md#getting-set-up-to-contribute +# 4. Environment variables for GITHUB_USER and GITHUB_TOKEN set. +# +# To run: +# sh ./cask-update.sh -version 1.3.0 + +cask-repair bitwarden --cask-version $version --blind-submit diff --git a/scripts/cask-update.sh b/scripts/cask-update.sh deleted file mode 100644 index 2a22cca1d3..0000000000 --- a/scripts/cask-update.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash -set -e - -# Dependencies: -# 1. brew install jq -# 2. fork of homebrew-cask repo setup. -# see https://github.com/caskroom/homebrew-cask/blob/master/CONTRIBUTING.md#getting-set-up-to-contribute -# -# To run: -# sh ./cask-update.sh -# -# then submit PR from fork repo - -FORK_GITHUB_USER="kspearrin" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -PWD_DIR="$(pwd)" -ROOT_DIR="$DIR/.." -DIST_DIR="$ROOT_DIR/dist" -CASK_DIR="$ROOT_DIR/stores/homebrew-cask" -DIST_CASK_DIR="$DIST_DIR/homebrew-cask" -GIT_CASKS_DIR=""$(brew --repository)"/Library/Taps/caskroom/homebrew-cask/Casks" - -if [ -d "$DIST_CASK_DIR" ] -then - rm -rf $DIST_CASK_DIR -fi - -cp -r $CASK_DIR $DIST_DIR - -SRC_PACKAGE="$ROOT_DIR/src/package.json"; -SRC_PACAKGE_VERSION=$(jq -r '.version' $SRC_PACKAGE) - -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") -RB="$DIST_CASK_DIR/bitwarden.rb" -RB_NEW="$DIST_CASK_DIR/bitwarden.rb.new" - -sed -e 's/__version__/'"$SRC_PACAKGE_VERSION"'/g; s/__checksum__/'"$CHECKSUM"'/g; s/__checkpoint__/'"$CHECKPOINT"'/g' $RB > $RB_NEW -mv -f $RB_NEW $RB - -cd $GIT_CASKS_DIR -git checkout master -git pull -git reset --hard origin/master -git push $FORK_GITHUB_USER master -git push -d $FORK_GITHUB_USER bitwarden || true -git branch -D bitwarden || true -git checkout -b bitwarden -GIT_CASKS_RB="$GIT_CASKS_DIR/bitwarden.rb" -cp $RB $GIT_CASKS_RB -git add $GIT_CASKS_RB -git commit -m "Update Bitwarden.app to v$SRC_PACAKGE_VERSION" -git push $FORK_GITHUB_USER bitwarden -cd $PWD_DIR diff --git a/scripts/snap-release.ps1 b/scripts/snap-release.ps1 new file mode 100644 index 0000000000..543e67583f --- /dev/null +++ b/scripts/snap-release.ps1 @@ -0,0 +1,9 @@ +# To run: +# ./snap-release.ps1 + +$dir = Split-Path -Parent $MyInvocation.MyCommand.Path; +$rootDir = $dir + "/.."; +$distDir = $rootDir + "/dist"; +$distSnap = $distDir + "/bitwarden*.snap"; + +snap push $distSnap --release stable