-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathpackage-github.sh
More file actions
executable file
·89 lines (66 loc) · 1.71 KB
/
package-github.sh
File metadata and controls
executable file
·89 lines (66 loc) · 1.71 KB
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
#!/bin/bash
APPLET_NAME="github-projects@morgan-design.com"
WORKING_DIR="/mnt/750-SpinPoint-A/Dropbox/workspace-gnome/github-explorer"
RELEASE_DIR="${WORKING_DIR}/releases"
PROJECT_DIR="${WORKING_DIR}/github-projects@morgan-design.com"
function usage_and_exit()
{
echo "missing a required parameter (version)"
echo "Add: $0 -v <version>"
exit 1;
}
while getopts "v:" flag; do
case "${flag}" in
v)
VERSION=${OPTARG}
echo "Using Version [${VERSION}]"
;;
*)
usage_and_exit
;;
esac
done
shift $((OPTIND-1))
if [[ -z "${VERSION}" ]];
then
usage_and_exit
fi
TAG_VERISON="V${VERSION}"
function checkForDuplicateTag {
echo "Checking current version $TAG_VERISON"
FOUND=$(git tag --list | grep $TAG_VERISON)
if [ "${FOUND}" == "${TAG_VERISON}" ]; then
echo "EXITING - Found Existing Version $TAG_VERISON"
exit 1;
fi
}
ZIP_NAME="${TAG_VERISON}-${APPLET_NAME}"
ZIP_FILE="${ZIP_NAME}.zip"
function packageZip {
echo "Moving to $PROJECT_DIR"
cd $PROJECT_DIR
echo "Packaging up ZIP - ${APPLET_NAME}"
zip -r $ZIP_FILE . -i '*.js' '*.json' '*.png' '*.md'
echo "Copy to releases dir"
cp -f $ZIP_FILE "${RELEASE_DIR}/${ZIP_NAME}.zip"
mv $ZIP_FILE "${WORKING_DIR}/${APPLET_NAME}.zip"
cd $WORKING_DIR
}
function createTag {
echo "Creating Tag ${TAG_VERISON}"
git tag $TAG_VERISON
echo "Pusing tag to repo"
# You can delete by removing local tag and pushin to origin git push origin :refs/tags/V1.3
git push --tags
}
function addAllFiles {
echo "Adding all files to Git"
git add -A
echo "Commiting All Files to Git"
git commit -m"Releasing ${TAG_VERISON}"
git push
}
checkForDuplicateTag;
packageZip;
addAllFiles;
createTag;