-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake-phar
More file actions
executable file
·81 lines (66 loc) · 1.43 KB
/
make-phar
File metadata and controls
executable file
·81 lines (66 loc) · 1.43 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
#!/bin/bash
set -o allexport
source ./.env
set +o allexport
# Parse args
while [[ $# > 1 ]]
do
key="$1"
case $key in
-n|--name)
APPNAME="$2"
shift # past argument
;;
-v|--version)
APPVERSION="$2"
shift # past argument
;;
-h|--help)
LIBPATH="$2"
shift # past argument
;;
*)
# unknown option
;;
esac
shift # past argument or value
done
if [ "" == "${APPNAME}" ] || [ "" == "${APPVERSION}" ]; then
echo "App name or version number not provided."
else
# Create matching version tag
echo "Tag creation"
git tag ${APPVERSION}
# Push everything
echo "Push to repo"
git push origin master
# Push tags
echo "Push tags"
git push --tags
# box building
echo "Box build"
box build
mv ${APPNAME}.phar /tmp/${APPNAME}.phar
echo "Goes to GH pages"
git checkout gh-pages
git pull origin gh-pages
mv /tmp/${APPNAME}.phar downloads/${APPNAME}-${APPVERSION}.phar
echo "Generating manifest"
rm manifest.json
sha1="$(sha1sum downloads/${APPNAME}-${APPVERSION}.phar | awk '{ print $1 }')"
cat <<EOF > manifest.json
[
{
"name": "${APPNAME}.phar",
"sha1": "${sha1}",
"url": "${GITHUB_PAGES}/${APPNAME}/downloads/${APPNAME}-${APPVERSION}.phar",
"version": "${APPVERSION}"
}
]
EOF
# Push to GH pages
git add .
git commit -m "Publish v${APPVERSION}"
git push origin gh-pages
git checkout master
fi