1 | #!/bin/sh
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | git_user_id=$1
|
7 | git_repo_id=$2
|
8 | release_note=$3
|
9 |
|
10 | if [ "$git_user_id" = "" ]; then
|
11 | git_user_id="GIT_USER_ID"
|
12 | echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
13 | fi
|
14 |
|
15 | if [ "$git_repo_id" = "" ]; then
|
16 | git_repo_id="GIT_REPO_ID"
|
17 | echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
18 | fi
|
19 |
|
20 | if [ "$release_note" = "" ]; then
|
21 | release_note="Minor update"
|
22 | echo "[INFO] No command line input provided. Set \$release_note to $release_note"
|
23 | fi
|
24 |
|
25 |
|
26 | git init
|
27 |
|
28 |
|
29 | git add .
|
30 |
|
31 |
|
32 | git commit -m "$release_note"
|
33 |
|
34 |
|
35 | git_remote=`git remote`
|
36 | if [ "$git_remote" = "" ]; then
|
37 |
|
38 | if [ "$GIT_TOKEN" = "" ]; then
|
39 | echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
|
40 | git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
|
41 | else
|
42 | git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
|
43 | fi
|
44 |
|
45 | fi
|
46 |
|
47 | git pull origin master
|
48 |
|
49 |
|
50 | echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
|
51 | git push origin master 2>&1 | grep -v 'To https'
|
52 |
|