1#!/bin/bash 2 3set -ex 4 5# Make sure we are in a protobuf source tree. 6[ -f "php/release.sh" ] || { 7 echo "This script must be ran under root of protobuf source tree." 8 exit 1 9} 10 11VERSION=$1 12 13git clone https://github.com/protocolbuffers/protobuf-php.git 14git clone https://github.com/protocolbuffers/protobuf.git 15 16# Clean old files 17pushd protobuf-php 18rm -rf src 19popd 20 21# Checkout the target version 22pushd protobuf/php 23git checkout -b $VERSION 24popd 25 26# Copy files 27pushd protobuf-php 28mv ../protobuf/php/src src 29mv ../protobuf/composer.json composer.json 30sed -i 's|php/src|src|g' composer.json 31git add . 32git commit -m "$VERSION" 33git tag "$VERSION" 34popd 35 36# Clean up 37rm -rf protobuf 38