#!/bin/bashset-ex# Make sure we are in a protobuf source tree.[-f"php/release.sh"]||{echo"This script must be ran under root of protobuf source tree."exit 1}VERSION=$1git clone https://github.com/protocolbuffers/protobuf-php.gitgit clone https://github.com/protocolbuffers/protobuf.git# Clean old filespushd protobuf-phprm-rf srcpopd# Checkout the target versionpushd protobuf/phpgit checkout $VERSIONpopd# Copy filespushd protobuf-phpmv ../protobuf/php/src srcmv ../protobuf/composer.json composer.jsonsed-i's|php/src|src|g' composer.jsongit add .git commit -m"$VERSION"git tag "$VERSION"popd# Clean uprm-rf protobuf