colobot-data/make-package.sh

32 lines
874 B
Bash
Raw Normal View History

2012-09-13 21:35:43 +00:00
#!/bin/bash
# Bash script to create a zipped package labeled with current date
# Get current date (UTC)
date=`date -u '+%Y-%m-%d'`
# Name of directory in zip
dir_name="colobot-data-$date"
# Name of zip
zip_name="$dir_name.zip"
2012-12-16 13:45:28 +00:00
# git branches
current_branch=$(git rev-parse --abbrev-ref HEAD)
release_branch=${current_branch}_release_$date
2012-09-13 21:35:43 +00:00
2012-12-16 13:45:28 +00:00
# Create new branch for the date substitution
git checkout -b $release_branch >/dev/null 2>&1
# Prepare the release where needed
sed -i 's/\[\[\[date\]\]\]/'"$date"'/' README.txt
2012-09-13 21:35:43 +00:00
2012-12-16 13:45:28 +00:00
# Commit the changes
git commit README.txt -m "colobot-data $date release" >/dev/null
# Create the zipfile
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