2019-06-01 18:51:33 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-06-07 00:25:43 +02:00
|
|
|
set -e
|
|
|
|
|
2019-06-07 23:58:23 +02:00
|
|
|
|
2021-02-11 19:45:04 +01:00
|
|
|
if [[ ${GITHUB_REPOSITORY} != 'vimeo/psalm' && -z ${PHAR_REPO_SLUG} ]]; then
|
2019-06-07 23:58:23 +02:00
|
|
|
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}
|
|
|
|
|
2021-02-11 19:45:04 +01:00
|
|
|
git clone https://${PHAR_REPO_TOKEN}@github.com/${PHAR_REPO_SLUG}.git phar > /dev/null 2>&1
|
2019-06-07 23:58:23 +02:00
|
|
|
|
|
|
|
set -x # don't do set x above this point to protect the GITHUB_TOKEN
|
|
|
|
|
2019-03-25 18:40:17 +01:00
|
|
|
cd phar
|
2019-06-07 14:18:58 +02:00
|
|
|
rm -rf *
|
2019-06-07 23:58:23 +02:00
|
|
|
cp ../build/psalm.phar ../assets/psalm-phar/* .
|
|
|
|
cp ../build/psalm.phar.asc || true # not all users have GPG keys
|
2019-06-07 00:12:53 +02:00
|
|
|
mv dot-gitignore .gitignore
|
2021-02-11 19:45:04 +01:00
|
|
|
git config user.email "github@muglug.com"
|
|
|
|
git config user.name "Automated commit"
|
2019-06-07 00:12:53 +02:00
|
|
|
git add --all .
|
2021-02-11 19:45:04 +01:00
|
|
|
git commit -m "Updated Psalm phar to commit ${GITHUB_SHA}"
|
2019-06-07 23:58:23 +02:00
|
|
|
git push --quiet origin master > /dev/null 2>&1
|
2019-06-01 16:25:26 +02:00
|
|
|
|
2021-02-13 22:45:13 +01:00
|
|
|
tag=${GITHUB_REF/refs\/heads\//}
|
|
|
|
|
|
|
|
if [[ "$tag" != 'master' ]] ; then
|
|
|
|
git tag "$tag"
|
|
|
|
git push origin "$tag"
|
2019-06-01 16:25:26 +02:00
|
|
|
fi
|