Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
149 lines (117 loc) · 3.62 KB

File metadata and controls

executable file
·
149 lines (117 loc) · 3.62 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#!/usr/bin/env bash
# Run this script to create a new release of phpsploit
SCRIPTDIR="$(readlink -f `dirname $0`)"
cd "$(git rev-parse --show-toplevel)"
# colors
RED='\033[0;31m'
GREEN='\033[0;32m'
BOLD='\033[1m'
NC='\033[0m' # No Color
########## ERROR HANDLING
# check arguments
if (( $# != 1 )); then
>&2 echo -e "Usage: $0 <version>"
>&2 echo -e "Example: ${GREEN}$0 3.0${NC}"
exit 1
fi
# check current branch is master
cur_branch="$(git rev-parse --abbrev-ref HEAD)"
if [ "$cur_branch" != "master" ]; then
>&2 echo -e "\n${RED}[-] Please checkout on master branch:${NC}"
>&2 echo -e " ${GREEN}git checkout master${NC}"
exit 1
fi
# check existence of `github_changelog_generator` tool
# needed to generate CHANGELOG.md
gh_changelog_gen="github_changelog_generator"
if ! which "$gh_changelog_gen" >/dev/null; then
>&2 echo -e "\n${RED}[-] Please install '$gh_changelog_gen':${NC}"
>&2 echo -e " ${GREEN}sudo gem install ${gh_changelog_gen}${NC}"
exit 1
fi
# check existence of `remark` tool
# needed to generate CHANGELOG.md
remark="remark"
if ! which "$remark" >/dev/null; then
>&2 echo -e "\n${RED}[-] Please install '$remark':${NC}"
>&2 echo -e " ${GREEN}sudo npm install -g remark-cli remark-preset-lint-recommended${NC}"
exit 1
fi
# check existence of `txt2tags` tool
# needed to run ./man/update-man.sh
txt2tags="txt2tags"
if ! which "$txt2tags" >/dev/null; then
>&2 echo -e "\n${RED}[-] Please install '$txt2tags':${NC}"
>&2 echo -e " ${GREEN}sudo apt install ${txt2tags}${NC}"
exit 1
fi
# make sure that git work tree is clean
# source: https://stackoverflow.com/questions/30063411/git-bash-script-check-working-tree
require_clean_work_tree () {
git rev-parse --verify HEAD >/dev/null || exit 1
git update-index -q --ignore-submodules --refresh
err=0
if ! git diff-files --quiet --ignore-submodules
then
echo >&2 "Cannot $1: You have unstaged changes."
err=1
fi
if ! git diff-index --cached --quiet --ignore-submodules HEAD --
then
if [ $err = 0 ]
then
echo >&2 "Cannot $1: Your index contains uncommitted changes."
else
echo >&2 "Additionally, your index contains uncommitted changes."
fi
err=1
fi
if [ $err = 1 ]
then
test -n "$2" && echo >&2 "$2"
exit 1
fi
}
require_clean_work_tree
if [ -n "$(git status --porcelain)" ]; then
>&2 echo -e "\n${RED}[-] Please commit or stash untracked files${NC}"
>&2 echo -e " ${GREEN}git status${NC}"
exit 1
fi
# check nothing to pull
local_head="$(git rev-parse HEAD)"
remote_head="$(git ls-remote origin master | cut -f1)"
if [ "$local_head" != "$remote_head" ]; then
>&2 echo -e "\n${RED}[-] Local branch != remote, please pull or push:${NC}"
>&2 echo -e " ${GREEN}git pull; git push${NC}"
exit 1
fi
########## MAKE RELEASE
VER=$1
TAG="v${VER}"
MSG="${VER} release"
# set verbose/err
set -ve
# replace VERSION string in ./phpsploit
sed -i '/^VERSION = /c\VERSION = "'${VER}'"' ./phpsploit
git add ./phpsploit
# generate CHANGELOG.md
github_changelog_generator --future-release ${TAG}
remark CHANGELOG.md -o
git add ./CHANGELOG.md
# update man page
./man/update-man.sh
git add ./man/
# create commit
git commit -m "$MSG"
# add release tag to created commit
git tag -a $TAG -m "$MSG"
# unset verbose/err
set +ve
echo -e "${BOLD}[+] Release commit created successfully${NC}"
echo -e ""
echo -e " 1. Check the release commit:"
echo -e " ${GREEN}git diff HEAD^${NC}"
echo -e ""
echo -e " 2. Push the commit and it's tag"
echo -e " ${GREEN}git push --follow-tags${NC}"
Morty Proxy This is a proxified and sanitized view of the page, visit original site.