2019-05-20 14:16:53 +02:00
|
|
|
#######################################################################
|
|
|
|
# To push new commits to the premaster branch, run: #
|
|
|
|
# bash git_premaster.sh "commit message" #
|
|
|
|
# #
|
|
|
|
# After successful CRAN checks, merge it to the master branch with: #
|
|
|
|
# bash git_merge.sh #
|
|
|
|
#######################################################################
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "FATAL - no commit message"
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-05-31 14:25:11 +02:00
|
|
|
if [ -z "$2" ]; then
|
|
|
|
lazy="TRUE"
|
|
|
|
else
|
|
|
|
lazy=$2
|
|
|
|
fi
|
2019-05-20 14:16:53 +02:00
|
|
|
|
|
|
|
echo "••••••••••••••••••••••••••••••••••••••••••••"
|
|
|
|
echo "• Updating package date and version number •"
|
|
|
|
echo "••••••••••••••••••••••••••••••••••••••••••••"
|
|
|
|
sed -i -- "s/^Date: .*/Date: $(date '+%Y-%m-%d')/" DESCRIPTION
|
|
|
|
# get latest tags
|
|
|
|
git pull --tags --quiet
|
2019-05-28 16:50:40 +02:00
|
|
|
current_tag=`git describe --tags --abbrev=0 | sed 's/v//'`
|
|
|
|
current_commit=`git describe --tags | sed 's/.*-\(.*\)-.*/\1/'`
|
|
|
|
# combine tag (e.g. 0.1.0) and commit number (like 40) increased by 9000 to indicate beta version
|
|
|
|
new_version="$current_tag.$((current_commit + 9000))" # results in 0.1.0.9040
|
2019-06-03 20:52:24 +02:00
|
|
|
if [ -z "$new_version" ]; then
|
|
|
|
new_version="$current_tag.9000"
|
|
|
|
echo
|
|
|
|
echo "** COULD NOT CREATE NEW VERSION NUMBER! **"
|
2019-06-11 15:31:32 +02:00
|
|
|
echo "Are there some unpushed changes in a new tag? Then mind NEWS.md. Assuming sequence number 9000."
|
2019-06-03 20:52:24 +02:00
|
|
|
echo
|
|
|
|
fi
|
2019-05-28 16:50:40 +02:00
|
|
|
sed -i -- "s/^Version: .*/Version: ${new_version}/" DESCRIPTION
|
2019-06-01 21:28:18 +02:00
|
|
|
# update 1st line of NEWS.md
|
2019-06-02 19:23:19 +02:00
|
|
|
sed -i -- "1s/.*/# AMR ${new_version}/" NEWS.md
|
2019-09-01 13:16:57 +02:00
|
|
|
# add date to 2nd line of NEWS.md
|
|
|
|
sed -i -- "2s/.*/\<small\>Last updated: $(date '+%d-%b-%Y')\<\/small\>/" NEWS.md
|
2019-07-30 19:20:13 +02:00
|
|
|
rm *-- || true
|
2019-06-11 15:31:32 +02:00
|
|
|
echo "• First 3 lines of DESCRIPTION:"
|
2019-05-20 14:16:53 +02:00
|
|
|
head -3 DESCRIPTION
|
|
|
|
echo
|
2019-09-01 13:16:57 +02:00
|
|
|
echo "• First 2 lines of NEWS.md:"
|
|
|
|
head -2 NEWS.md
|
2019-06-01 21:28:18 +02:00
|
|
|
echo
|
2019-05-20 14:16:53 +02:00
|
|
|
echo "•••••••••••••••••••••••••••••••••"
|
2019-06-01 20:40:49 +02:00
|
|
|
echo "• Reloading/documenting package •"
|
2019-05-20 14:16:53 +02:00
|
|
|
echo "•••••••••••••••••••••••••••••••••"
|
|
|
|
Rscript -e "devtools::load_all(quiet = TRUE)"
|
2019-06-11 15:31:32 +02:00
|
|
|
echo "• Documenting..."
|
2019-05-20 14:16:53 +02:00
|
|
|
Rscript -e "suppressMessages(devtools::document())"
|
|
|
|
echo
|
2019-06-01 20:40:49 +02:00
|
|
|
echo "••••••••••••••••••••••••••"
|
|
|
|
echo "• Updating internal data •"
|
|
|
|
echo "••••••••••••••••••••••••••"
|
|
|
|
Rscript -e "source('data-raw/internals.R')"
|
|
|
|
echo
|
2019-05-20 14:16:53 +02:00
|
|
|
echo "•••••••••••••••••"
|
|
|
|
echo "• Building site •"
|
|
|
|
echo "•••••••••••••••••"
|
2019-09-22 17:19:59 +02:00
|
|
|
echo "• Installing..."
|
|
|
|
Rscript -e "devtools::install(quiet = TRUE, dependencies = FALSE)"
|
2019-05-31 14:25:11 +02:00
|
|
|
Rscript -e "suppressMessages(pkgdown::build_site(lazy = $lazy, examples = FALSE))"
|
2019-05-20 14:16:53 +02:00
|
|
|
echo
|
|
|
|
echo "•••••••••••••••••••••••••"
|
|
|
|
echo "• List of changed files •"
|
|
|
|
echo "•••••••••••••••••••••••••"
|
|
|
|
git status --short
|
|
|
|
echo
|
2019-06-22 20:14:06 +02:00
|
|
|
read -p "Uploading version ${new_version}. Continue (Y/n)? " choice
|
2019-05-20 14:16:53 +02:00
|
|
|
case "$choice" in
|
|
|
|
n|N ) exit 1;;
|
|
|
|
* ) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
echo
|
|
|
|
echo "•••••••••••••••••••••••••••"
|
|
|
|
echo "• Uploading to repository •"
|
|
|
|
echo "•••••••••••••••••••••••••••"
|
|
|
|
git add .
|
2019-05-30 08:51:38 +02:00
|
|
|
git commit -a -m "(v$new_version) $1" --quiet
|
2019-05-20 14:16:53 +02:00
|
|
|
git push --quiet
|
|
|
|
echo "Comparison:"
|
|
|
|
echo "https://gitlab.com/msberends/AMR/compare/master...premaster?view=inline"
|
2019-06-22 21:33:13 +02:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "•••••••••"
|
|
|
|
echo "• Done •"
|
|
|
|
echo "••••••••"
|
|
|
|
echo
|
2019-10-07 15:12:42 +02:00
|
|
|
|
2019-10-13 09:31:58 +02:00
|
|
|
read -p "Use R-hub to simulate all CRAN checks (y/N)? " choice
|
|
|
|
case "$choice" in
|
|
|
|
y|Y|j|J ) ;;
|
|
|
|
* ) exit 1;;
|
|
|
|
esac
|
|
|
|
Rscript -e "rhub::check(devtools::build(), platform = c('debian-clang-devel', 'debian-gcc-devel', 'fedora-clang-devel', 'fedora-gcc-devel', 'windows-x86_64-devel', 'debian-gcc-patched', 'solaris-x86-patched', 'debian-gcc-release', 'windows-x86_64-release', 'macos-elcapitan-release', 'windows-x86_64-oldrel'))"
|
|
|
|
echo
|