forked from vimeo/psalm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub-deploy-phar.sh
executable file
·41 lines (30 loc) · 1.02 KB
/
github-deploy-phar.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
#!/usr/bin/env bash
set -e
if [[ ${GITHUB_REPOSITORY} != 'vimeo/psalm' && -z ${PHAR_REPO_SLUG} ]]; then
echo 'Not attempting phar deployment, as this is not vimeo/psalm, and $PHAR_REPO_SLUG is unset or empty'
exit 0;
fi;
PHAR_REPO_SLUG=${PHAR_REPO_SLUG:=psalm/phar}
git clone https://${PHAR_REPO_TOKEN}@github.com/${PHAR_REPO_SLUG}.git phar > /dev/null 2>&1
set -x # don't do set x above this point to protect the GITHUB_TOKEN
cd phar
rm -rf *
cp ../build/psalm.phar ../assets/psalm-phar/* .
cp ../build/psalm.phar.asc . || true # not all users have GPG keys
mv dot-gitignore .gitignore
git config user.email "[email protected]"
git config user.name "Automated commit"
git add --all .
git commit -m "Updated Psalm phar to commit ${GITHUB_SHA}"
tag=${GITHUB_REF/refs\/heads\//}
tag=${tag/refs\/tags\//}
if [[ "$tag" != 'master' ]] ; then
git tag "$tag"
fi
# this script runs on:
# 1. pushes to master
# 2. publishing releases
#
# So we push master to psalm/phar:master
# and tags to psalm/phar:$tag
git push origin "$tag"