diff options
| -rw-r--r-- | alias | 12 | ||||
| -rwxr-xr-x | scripts/upload-github-release-asset.sh | 8 |
2 files changed, 15 insertions, 5 deletions
| @@ -26,13 +26,19 @@ alias src="source $HOME/.$(basename $SHELL)rc" | |||
| 26 | alias ll='ls -alh' | 26 | alias ll='ls -alh' |
| 27 | alias si='sudo snap install' # snap install | 27 | alias si='sudo snap install' # snap install |
| 28 | alias ni='sudo npm install -g' # nodejs install | 28 | alias ni='sudo npm install -g' # nodejs install |
| 29 | alias ss='sudo !!' | ||
| 30 | alias hg='history|grep' | 29 | alias hg='history|grep' |
| 31 | alias rmrf='rm -rf' | 30 | alias rmrf='rm -rf' |
| 32 | alias rr='move_to_tmp' | 31 | alias rr='move_to_tmp' |
| 33 | move_to_tmp() { | 32 | move_to_tmp() { |
| 34 | mv $@ /tmp | 33 | mv $@ /tmp |
| 35 | } | 34 | } |
| 35 | prompt() { | ||
| 36 | TMPFILE=$(mktemp) echo $1 > $TMPFILE && \ | ||
| 37 | vim $TMPFILE && \ | ||
| 38 | sed -i '$ q; s/$/ \\/' $TMPFILE && \ | ||
| 39 | cat $TMPFILE && \ | ||
| 40 | source $TMPFILE | ||
| 41 | } | ||
| 36 | 42 | ||
| 37 | # package | 43 | # package |
| 38 | alias ai='sudo apt install' # apt install | 44 | alias ai='sudo apt install' # apt install |
| @@ -99,6 +105,10 @@ gcg() { | |||
| 99 | } | 105 | } |
| 100 | alias gls='git log -S' | 106 | alias gls='git log -S' |
| 101 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule | 107 | alias cdgs='cd $(git submodule status | sed "s/^.//" | cut -d" " -f2)' # cd to first submodule |
| 108 | upload() { | ||
| 109 | command="upload-github-release-asset.sh\n github_api_token=$(cat ~/settings/tokens/github)\n owner=typebrook\n repo=tig\n tag=LATEST\n filename=$(which tig)\n overwrite=false" | ||
| 110 | prompt "$command" | ||
| 111 | } | ||
| 102 | 112 | ||
| 103 | # docker | 113 | # docker |
| 104 | alias dp='docker ps' | 114 | alias dp='docker ps' |
diff --git a/scripts/upload-github-release-asset.sh b/scripts/upload-github-release-asset.sh index 6923870..0325530 100755 --- a/scripts/upload-github-release-asset.sh +++ b/scripts/upload-github-release-asset.sh | |||
| @@ -62,17 +62,17 @@ eval $(echo "$response" | grep -C2 "\"name\":.\+$(basename $filename)" | grep -m | |||
| 62 | if [ "$asset_id" = "" ]; then | 62 | if [ "$asset_id" = "" ]; then |
| 63 | echo "No need to overwrite asset" | 63 | echo "No need to overwrite asset" |
| 64 | else | 64 | else |
| 65 | if [ "$overwrite" ]; then | 65 | if [[ "$overwrite" == "true" ]] || [[ "$overwrite" == "delete" ]]; then |
| 66 | echo "Deleting asset($asset_id)... " | 66 | echo "Deleting asset($asset_id)... " |
| 67 | curl -X "DELETE" -H "Authorization: token $github_api_token" "https://api.github.com/repos/$owner/$repo/releases/assets/$asset_id" | 67 | curl -X "DELETE" -H "Authorization: token $github_api_token" "https://api.github.com/repos/$owner/$repo/releases/assets/$asset_id" |
| 68 | if [[ "$overwrite" == "delete" ]]; then | ||
| 69 | exit 0 | ||
| 70 | fi | ||
| 68 | else | 71 | else |
| 69 | echo "File already exists on tag $tag" | 72 | echo "File already exists on tag $tag" |
| 70 | echo "If you want to overwrite it, set overwrite=true" | 73 | echo "If you want to overwrite it, set overwrite=true" |
| 71 | exit 1 | 74 | exit 1 |
| 72 | fi | 75 | fi |
| 73 | if [ "$overwrite" == "delete" ]; then | ||
| 74 | exit 0 | ||
| 75 | fi | ||
| 76 | fi | 76 | fi |
| 77 | 77 | ||
| 78 | # Upload asset | 78 | # Upload asset |