mirror of
https://github.com/php-flasher/php-flasher.git
synced 2026-03-31 15:07:47 +01:00
82 lines
1.9 KiB
Bash
Executable File
82 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
# Make sure the release tag is provided.
|
|
if (( "$#" != 1 ))
|
|
then
|
|
echo "Tag has to be provided."
|
|
|
|
exit 1
|
|
fi
|
|
|
|
RELEASE_BRANCH="main"
|
|
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
|
VERSION=$1
|
|
|
|
# Make sure current branch and release branch match.
|
|
if [[ "$RELEASE_BRANCH" != "$CURRENT_BRANCH" ]]
|
|
then
|
|
echo "Release branch ($RELEASE_BRANCH) does not match the current active branch ($CURRENT_BRANCH)."
|
|
|
|
exit 1
|
|
fi
|
|
|
|
# Make sure the working directory is clear.
|
|
if [[ ! -z "$(git status --porcelain)" ]]
|
|
then
|
|
echo "Your working directory is dirty. Did you forget to commit your changes?"
|
|
|
|
exit 1
|
|
fi
|
|
|
|
# Make sure latest changes are fetched first.
|
|
git fetch origin
|
|
|
|
# Make sure that release branch is in sync with origin.
|
|
if [[ $(git rev-parse HEAD) != $(git rev-parse origin/$RELEASE_BRANCH) ]]
|
|
then
|
|
echo "Your branch is out of date with its upstream. Did you forget to pull or push any changes before releasing?"
|
|
|
|
exit 1
|
|
fi
|
|
|
|
# Always prepend with "v"
|
|
if [[ $VERSION != v* ]]
|
|
then
|
|
VERSION="v$VERSION"
|
|
fi
|
|
|
|
# Tag PHP Flasher
|
|
git tag "$VERSION"
|
|
git push origin --tags --force
|
|
|
|
# Tag Repositories
|
|
for REMOTE in flasher flasher-laravel flasher-symfony \
|
|
flasher-toastr flasher-toastr-laravel flasher-toastr-symfony \
|
|
flasher-notyf flasher-notyf-laravel flasher-notyf-symfony \
|
|
flasher-sweet-alert flasher-sweet-alert-laravel flasher-sweet-alert-symfony \
|
|
flasher-pnotify flasher-pnotify-laravel flasher-pnotify-symfony \
|
|
flasher-noty flasher-noty-laravel flasher-noty-symfony
|
|
do
|
|
echo ""
|
|
echo ""
|
|
echo "Releasing $REMOTE";
|
|
|
|
TMP_DIR="/tmp/php-flasher"
|
|
REMOTE_URL="git@github.com:php-flasher/$REMOTE.git"
|
|
|
|
rm -rf $TMP_DIR;
|
|
mkdir $TMP_DIR;
|
|
|
|
(
|
|
cd $TMP_DIR;
|
|
|
|
git clone $REMOTE_URL .
|
|
git checkout "$RELEASE_BRANCH";
|
|
|
|
git tag "$VERSION"
|
|
git push origin --tags
|
|
)
|
|
done
|