Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 73 lines (59 sloc) 1.96 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
#!/bin/bash

set -e

MY_PATH=$(cd ${0%/*} && echo $PWD/${0##*/})
TOOL_PATH=`dirname "$MY_PATH"`
PFC_PATH=$TOOL_PATH/..
VERSION=`$TOOL_PATH/get-version`

# if version do not exists as a tag,
# get the latest commit id as the latest version number
if [ "`git tag -l | grep $VERSION`" == "" ]; then
  VERSION_GIT="`git log --pretty=format:'%h' -n 1`"
else
  VERSION_GIT="$VERSION"
fi

# a temp folder to clone the git
TMP_DIR=$PFC_PATH/tmp
mkdir -p $TMP_DIR

if [ "$1" == "--dev" ]; then
  PFC_AN_SUFFIX="-dev"
  PFC_ARCHIVE_NAME="phpfreechat-`$TOOL_PATH/get-version`"
  
  # clone the git with the correct name
  rm -rf $TMP_DIR/$PFC_ARCHIVE_NAME
  git clone file://$PFC_PATH $TMP_DIR/$PFC_ARCHIVE_NAME
  
  # cleanup the pfc files
  cd $TMP_DIR/$PFC_ARCHIVE_NAME
  git checkout $VERSION_GIT
  make clean-release-for-dev
elif [ "$1" == "--debug" ]; then
  PFC_AN_SUFFIX="-debug"
  PFC_ARCHIVE_NAME="phpfreechat-`$TOOL_PATH/get-version`"
  
  # clone the git with the correct name
  rm -rf $TMP_DIR/$PFC_ARCHIVE_NAME
  git clone file://$PFC_PATH $TMP_DIR/$PFC_ARCHIVE_NAME
  
  # cleanup the pfc files
  cd $TMP_DIR/$PFC_ARCHIVE_NAME
  git checkout $VERSION_GIT
  make clean-release-for-debug
else
  PFC_AN_SUFFIX=""
  PFC_ARCHIVE_NAME="phpfreechat-`$TOOL_PATH/get-version`"

  # clone the git with the correct name
  rm -rf $TMP_DIR/$PFC_ARCHIVE_NAME
  git clone file://$PFC_PATH $TMP_DIR/$PFC_ARCHIVE_NAME
  
  # cleanup the pfc files
  cd $TMP_DIR/$PFC_ARCHIVE_NAME
  git checkout $VERSION_GIT
  make clean-release-for-prod
fi

# generate the tar.gz and .zip
cd $TMP_DIR
tar czf $PFC_ARCHIVE_NAME$PFC_AN_SUFFIX.tar.gz $PFC_ARCHIVE_NAME/
zip -Tq9r $PFC_ARCHIVE_NAME$PFC_AN_SUFFIX.zip $PFC_ARCHIVE_NAME/

# move archives into a version directory ready to upload
mkdir -p $PFC_PATH/$VERSION
mv $PFC_ARCHIVE_NAME$PFC_AN_SUFFIX.tar.gz $PFC_PATH/$VERSION/
mv $PFC_ARCHIVE_NAME$PFC_AN_SUFFIX.zip $PFC_PATH/$VERSION/

# cleanup
rm -rf $TMP_DIR
cd $PFC_PATH
exit 0
Something went wrong with that request. Please try again.