-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish-version.sh
executable file
·62 lines (46 loc) · 996 Bytes
/
publish-version.sh
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
#!/bin/bash
set -e
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` <tag>"
exit 65
fi
TAG=$1
mkdir temp-repo
cp -r .git temp-repo/
#
# Tag & build master branch
#
git tag ${TAG}
./build.sh
cp vagma temp-repo/vagma.phar
#
# Copy executable file into GH pages
#
cd temp-repo
git checkout gh-pages
git pull
mkdir -p downloads
cp vagma.phar downloads/vagma-${TAG}.phar
git add downloads/vagma-${TAG}.phar
SHA1=$(openssl sha1 vagma.phar)
IFS=', ' read -r -a sha <<< "$SHA1"
JSON='"name":"vagma.phar"'
JSON="${JSON},\"sha1\":\"${sha[1]}\""
JSON="${JSON},\"url\":\"https://andreklang.github.io/vagrant-manager/downloads/vagma-${TAG}.phar\""
JSON="${JSON},\"version\":\"${TAG}\""
#
# Update manifest
#
php ../updateManifest.php manifest.json '{'$JSON'}'
git add manifest.json
git commit -m "Publish version ${TAG}"
# push pages
git push origin gh-pages
# go back
cd ..
# push the tag
git push origin refs/tags/${TAG}
# pull the changes
git pull
# remove the temp-repo
rm -fr temp-repo