xref: /aosp_15_r20/external/protobuf/php/release.sh (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1*1b3f573fSAndroid Build Coastguard Worker#!/bin/bash
2*1b3f573fSAndroid Build Coastguard Worker
3*1b3f573fSAndroid Build Coastguard Workerset -ex
4*1b3f573fSAndroid Build Coastguard Worker
5*1b3f573fSAndroid Build Coastguard Worker# Make sure we are in a protobuf source tree.
6*1b3f573fSAndroid Build Coastguard Worker[ -f "php/release.sh" ] || {
7*1b3f573fSAndroid Build Coastguard Worker  echo "This script must be ran under root of protobuf source tree."
8*1b3f573fSAndroid Build Coastguard Worker  exit 1
9*1b3f573fSAndroid Build Coastguard Worker}
10*1b3f573fSAndroid Build Coastguard Worker
11*1b3f573fSAndroid Build Coastguard WorkerVERSION=$1
12*1b3f573fSAndroid Build Coastguard Worker
13*1b3f573fSAndroid Build Coastguard Workerrm -rf protobuf-php
14*1b3f573fSAndroid Build Coastguard Workergit clone https://github.com/protocolbuffers/protobuf-php.git
15*1b3f573fSAndroid Build Coastguard Worker
16*1b3f573fSAndroid Build Coastguard Worker# Clean old files
17*1b3f573fSAndroid Build Coastguard Workerrm -rf protobuf-php/src
18*1b3f573fSAndroid Build Coastguard Worker
19*1b3f573fSAndroid Build Coastguard Worker# Copy files
20*1b3f573fSAndroid Build Coastguard Workercp -r php/src protobuf-php
21*1b3f573fSAndroid Build Coastguard Workercp php/composer.json.dist protobuf-php/composer.json
22*1b3f573fSAndroid Build Coastguard Worker
23*1b3f573fSAndroid Build Coastguard Workercd protobuf-php
24*1b3f573fSAndroid Build Coastguard Workergit add .
25*1b3f573fSAndroid Build Coastguard Workergit commit -m "$VERSION"
26*1b3f573fSAndroid Build Coastguard Workerif [ $(git tag -l "$VERSION") ]; then
27*1b3f573fSAndroid Build Coastguard Worker  echo "tag $VERSION already exists"
28*1b3f573fSAndroid Build Coastguard Workerelse
29*1b3f573fSAndroid Build Coastguard Worker  git tag "$VERSION"
30*1b3f573fSAndroid Build Coastguard Workerfi
31