-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathupdate-phar
More file actions
executable file
·50 lines (33 loc) · 1.03 KB
/
update-phar
File metadata and controls
executable file
·50 lines (33 loc) · 1.03 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
#!/usr/bin/env bash
set -ex
version=${1-"same"}
current_rev=$(git rev-parse HEAD)
current_rev=${current_rev:0:10}
packages_repo=../wp-cli-packages
fname="phar/wp-cli.phar"
# generate archive
php -dphar.readonly=0 ./utils/make-phar.php $packages_repo/$fname --quiet --version=$version --store-version
cd $packages_repo
# smoke test
php $fname --version
# check which wp-cli commit the previous Phar archive was based on
# can't use the md5 hash, since it will be different each time the
# archive is generated
new_commit_subj="update wp-cli.phar to wp-cli/wp-cli@$current_rev"
current_commit_subj=$(git show -s --pretty=format:%s HEAD)
if [ "$new_commit_subj" = "$current_commit_subj" ]; then
echo "already at latest revision"
exit 1
fi
# generate md5 checksum
if [ command -v md5sum > /dev/null ]
then
md5hash=$(md5sum $fname)
else
md5hash=$(md5 -r $fname)
fi
echo $md5hash | cut -d ' ' -f 1 > $fname.md5
sha512sum $fname | cut -d ' ' -f 1 > $fname.sha512
git add $fname $fname.md5 $fname.sha512
git commit -m "$new_commit_subj"
git push