From 16a42dfc6b96ed7d5406eac608deb73883bd4ad7 Mon Sep 17 00:00:00 2001 From: Automatic Release Builder Date: Thu, 17 Nov 2016 15:38:09 +0100 Subject: [PATCH] Add the scripts to automize the release process --- release_builder/create-release-branch-for.sh | 73 ++++++++++++++++++++ release_builder/create-release-branch.sh | 42 +++++++++++ 2 files changed, 115 insertions(+) create mode 100755 release_builder/create-release-branch-for.sh create mode 100755 release_builder/create-release-branch.sh diff --git a/release_builder/create-release-branch-for.sh b/release_builder/create-release-branch-for.sh new file mode 100755 index 0000000..7c55992 --- /dev/null +++ b/release_builder/create-release-branch-for.sh @@ -0,0 +1,73 @@ +#!/bin/bash +#This file is part of FlightGear +# +#FlightGear is free software: you can redistribute it and/or modify +#it under the terms of the GNU General Public License as published by +#the Free Software Foundation, either version 2 of the License, or +#(at your option) any later version. +# +#FlightGear is distributed in the hope that it will be useful, +#but WITHOUT ANY WARRANTY; without even the implied warranty of +#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#GNU General Public License for more details. +# +#You should have received a copy of the GNU General Public License +#along with Foobar. If not, see . + +if [ -z "$1" -o -z "$2" ]; then + echo "usage: thismajor.thisminor nextmajor.nextminor path" + exit +fi + + +IFS='.' read -r -a VERSION_A <<< "$1" +shift +if [ ${#VERSION_A[@]} != 2 ]; then + echo "Need version as 'number.number'" + exit +fi +THIS_MAJOR_VERSION=${VERSION_A[0]} +THIS_MINOR_VERSION=${VERSION_A[1]} +RELEASE_BRANCH="release/${THIS_MAJOR_VERSION}.${THIS_MINOR_VERSION}" + +IFS='.' read -r -a VERSION_A <<< "$1" +shift +if [ ${#VERSION_A[@]} != 2 ]; then + echo "Need version as 'number.number'" + exit +fi +NEXT_MAJOR_VERSION=${VERSION_A[0]} +NEXT_MINOR_VERSION=${VERSION_A[1]} + +setVersionTo() { + local V="$1" + echo "setting version to $V" + echo "$V" > version + git add version + echo "new version: $V" | git commit --file=- + git tag "version/$V" +} + +createBranch() { + echo "Preparing release in `pwd`" + + git checkout next + git pull --rebase + + setVersionTo "${THIS_MAJOR_VERSION}.${THIS_MINOR_VERSION}.1" + + echo "Creating branch $RELEASE_BRANCH for version $(cat version) in `pwd`" + git branch "$RELEASE_BRANCH" + + setVersionTo "${NEXT_MAJOR_VERSION}.${NEXT_MINOR_VERSION}.0" +} + +while [ $# -gt 0 ]; do + echo "Processing $1" + pushd $1 > /dev/null + git config user.name "Automatic Release Builder" + git config user.email "build@flightgear.org" + createBranch + popd > /dev/null + shift +done diff --git a/release_builder/create-release-branch.sh b/release_builder/create-release-branch.sh new file mode 100755 index 0000000..7784562 --- /dev/null +++ b/release_builder/create-release-branch.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +THIS_RELEASE="2016.4" +NEXT_RELEASE="2017.1" +SUBMODULES="simgear flightgear fgdata" + +:<< 'COMMENT_END' +git checkout next +git pull --rebase + +$(dirname $0)/create-release-branch-for.sh "$THIS_RELEASE" "$NEXT_RELEASE" $SUBMODULES . + +# use release branch for submodules +git checkout release/${THIS_RELEASE} +for f in $SUBMODULES; do + git config -f .gitmodules submodule.${f}.branch release/${THIS_RELEASE} +done +git add .gitmodules && echo "set correct release-branch for submodules" | git commit --file=- + +# track submodule changes +git checkout next +git add $SUBMODULES && echo "track submodule changes for release" | git commit --file=- +COMMENT_END + +for f in $SUBMODULES .; do + pushd "$f" + echo "Pushing $f" + git checkout release/${THIS_RELEASE} && git push origin release/${THIS_RELEASE} && git push origin version/${THIS_RELEASE}.1 && git push origin version/${NEXT_RELEASE}.0 && git checkout next && git push + popd +done + +#this needs ~/.ssh/config to contain this +#HOST sf svn.code.sf.net +# HOSTNAME svn.code.sf.net +# IdentityFile ~/.ssh/your_sf_keyfile +# IdentitiesOnly yes +# User user_sf_username + +svn copy svn+ssh://svn.code.sf.net/p/flightgear/fgaddon/trunk \ + svn+ssh://svn.code.sf.net/p/flightgear/fgaddon/branches/release-${THIS_RELEASE} \ + -m "branching for release ${THIS_RELEASE}" +