#!/bin/bash set -e # This script used to only update github # it shoudl be called "publish_sdk" but # it gets called from the ops repo and there's # no way to atomically change both repos # so we keep the name SDK="spark_sdk" STAGE="/tmp/bts_staging" SRC=$1 GH=$2 TG=$3 OPP=$4 if [ "$#" -lt 3 ]; then echo "update_github.sh [-push_params]" echo "set tag to 'stage' if you don't want to push" exit 0 fi if [ "$TG" == "stage" ]; then echo "STAGE ONLY"; fi git lfs install if [ -d "$STAGE" ]; then rm -rf $STAGE fi mkdir $STAGE git clone --recurse-submodules "$GH" $STAGE/$SDK rm -rf $STAGE/$SDK/* cp -L -r -f "$SRC"/** $STAGE/$SDK/ pushd $STAGE/$SDK #clean all the stuff we don't want in github rm ./examples/*/*.so rm ./lib/data_files/cert_secure_logon.txt ./disable_onixs.py ./lib/libspark.so rm -r ./externals/lib/libonixs* rm -r ./externals/include/OnixS/ rm -r ./externals/lib/celoxica/ rm -r ./externals/include/celoxica/ if [ "$TG" != "stage" ]; then git status git add . git commit -m "$SDK update $TG" git tag "$TG" git push origin master --tags $OPP popd rm -rf $STAGE fi