Refactor archive creation.
parent
efda47ba66
commit
b07fd6240a
|
@ -1,6 +1,6 @@
|
||||||
# Colobot Data Files
|
# Colobot Data Files
|
||||||
|
|
||||||
## Development Release 2012-10-05
|
## Development Release [[[date]]]
|
||||||
|
|
||||||
This package contains the data files for the Colobot project (https://github.com/colobot/colobot).
|
This package contains the data files for the Colobot project (https://github.com/colobot/colobot).
|
||||||
It includes (or will include):
|
It includes (or will include):
|
||||||
|
|
|
@ -4,25 +4,28 @@
|
||||||
|
|
||||||
# Get current date (UTC)
|
# Get current date (UTC)
|
||||||
date=`date -u '+%Y-%m-%d'`
|
date=`date -u '+%Y-%m-%d'`
|
||||||
# Temp working dir
|
|
||||||
temp_dir="/tmp/colobot-data.$RANDOM"
|
|
||||||
# Name of directory in zip
|
# Name of directory in zip
|
||||||
dir_name="colobot-data-$date"
|
dir_name="colobot-data-$date"
|
||||||
# Name of zip
|
# Name of zip
|
||||||
zip_name="$dir_name.zip"
|
zip_name="$dir_name.zip"
|
||||||
|
|
||||||
echo "Copying files to temp dir: $temp_dir"
|
# git branches
|
||||||
mkdir "$temp_dir"
|
current_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||||
cp -R . "$temp_dir/$dir_name"
|
release_branch=${current_branch}_release_$date
|
||||||
|
|
||||||
old_pwd=`pwd`
|
# Create new branch for the date substitution
|
||||||
cd "$temp_dir"
|
git checkout -b $release_branch >/dev/null 2>&1
|
||||||
sed -i 's/\[\[\[date\]\]\]/'"$date"'/' "$dir_name/README.txt"
|
# Prepare the release where needed
|
||||||
echo "Zipping files"
|
sed -i 's/\[\[\[date\]\]\]/'"$date"'/' README.txt
|
||||||
zip -9 -r "$zip_name" "$dir_name" > /dev/null
|
|
||||||
|
|
||||||
cd "$old_pwd"
|
# Commit the changes
|
||||||
mv "$temp_dir/$zip_name" .
|
git commit README.txt -m "colobot-data $date release" >/dev/null
|
||||||
echo "Removing temp files"
|
|
||||||
rm -rf "$temp_dir"
|
# Create the zipfile
|
||||||
echo "Package $zip_name created"
|
echo -n "Creating package $zip_name …"
|
||||||
|
git archive --prefix=$dir_name/ --format=zip $release_branch > ../$dir_name.zip
|
||||||
|
echo " done!"
|
||||||
|
|
||||||
|
# Cleanup our trails
|
||||||
|
git checkout $current_branch >/dev/null 2>&1
|
||||||
|
git branch -D $release_branch >/dev/null
|
||||||
|
|
Loading…
Reference in New Issue