Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
8255a394
Commit
8255a394
authored
Jun 27, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve release script.
parent
49292792
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
174 additions
and
35 deletions
+174
-35
release.sh
release.sh
+174
-35
No files found.
release.sh
View file @
8255a394
...
@@ -4,31 +4,35 @@ set -euo pipefail
...
@@ -4,31 +4,35 @@ set -euo pipefail
doit
()
{
doit
()
{
echo
"@@@@
$@
"
echo
"@@@@
$@
"
"
$@
"
#
"$@"
}
}
BRANCH
=
$(
git rev-parse
--abbrev-ref
HEAD
)
get_version
()
{
local
VERSION
=
$(
grep
AC_INIT c++/configure.ac |
sed
-e
's/^[^]]*],\[\([^]]*\)].*$/\1/g'
)
case
"
$BRANCH
"
in
if
[[
!
"
$VERSION
"
=
~
$1
]]
;
then
master
)
echo
"Couldn't parse version:
$VERSION
"
>
&2
if
[
"x
${
1
:-}
"
!=
xcandidate
]
;
then
echo
"Parameter must be 'candidate' when starting from master branch."
>
&2
exit
1
exit
1
fi
fi
echo
"
$VERSION
"
}
echo
"New major release."
get_release_version
()
{
get_version
'^[0-9]+[.][0-9]+[.][0-9]+(-rc[0-9]+)?$'
}
VERSION
=
$(
grep
AC_INIT c++/configure.ac |
sed
-e
's/^.*],\[\([^]]*\)-dev].*$/\1/g'
)
update_version
()
{
local
OLD
=
$1
local
NEW
=
$2
local
BRANCH_DESC
=
$3
echo
"Version:
$VERSION
.0"
local
OLD_REGEX
=
${
OLD
//./[.]
}
doit
sed
-i
-e
"s/
$OLD_REGEX
/
$NEW
/g"
c++/configure.ac compiler/capnproto-compiler.cabal
doit git commit
-a
-m
"Set
$BRANCH_DESC
version to
$NEW
."
}
echo
"========================================================================="
build_packages
()
{
echo
"Creating release branch..."
local
VERSION
=
$1
echo
"========================================================================="
local
VERSION_BASE
=
${
VERSION
%%-*
}
doit git checkout
-b
release-
$VERSION
.0
VERSION_REGEX
=
${
VERSION
/./[.]
}
-dev
doit
sed
-i
-e
"s/
$VERSION_REGEX
/
$VERSION
.0-rc1/g"
c++/configure.ac compiler/capnproto-compiler.cabal
doit git commit
-a
-m
"Set release branch version to
$VERSION
.0-rc1."
echo
"========================================================================="
echo
"========================================================================="
echo
"Building compiler package..."
echo
"Building compiler package..."
...
@@ -36,7 +40,7 @@ case "$BRANCH" in
...
@@ -36,7 +40,7 @@ case "$BRANCH" in
cd
compiler
cd
compiler
doit cabal configure
doit cabal configure
doit cabal sdist
doit cabal sdist
doit
cp
dist/capnproto-compiler-
$VERSION
.0.tar.gz ../capnproto-compiler-
$VERSION
.0-rc1
.tar.gz
doit
cp
dist/capnproto-compiler-
$VERSION_BASE
.tar.gz ../capnproto-compiler-
$VERSION
.tar.gz
doit cabal clean
doit cabal clean
cd
..
cd
..
...
@@ -48,45 +52,180 @@ case "$BRANCH" in
...
@@ -48,45 +52,180 @@ case "$BRANCH" in
doit autoreconf
-i
doit autoreconf
-i
doit ./configure
doit ./configure
doit make dist
doit make dist
doit
mv
capnproto-c++-
$VERSION
.0-rc1
.tar.gz ..
doit
mv
capnproto-c++-
$VERSION
.tar.gz ..
doit make maintainer-clean
doit make maintainer-clean
cd
..
cd
..
}
cherry_pick
()
{
shift
if
[
$#
-gt
0
]
;
then
echo
"========================================================================="
echo
"========================================================================="
echo
"
Updating version in master branch...
"
echo
"
Cherry-picking fixes
"
echo
"========================================================================="
echo
"========================================================================="
doit git checkout master
doit git cherry-pick
"
$@
"
declare
-a
VERSION_ARR
=(
${
VERSION
/./
}
)
fi
NEXT_VERSION
=
${
VERSION_ARR
[0]
}
.
$((
VERSION_ARR[1]
+
1
))
}
doit
sed
-i
-e
"s/
$VERSION_REGEX
/
$NEXT_VERSION
-dev/g"
c++/configure.ac compiler/capnproto-compiler.cabal
doit git commit
-a
-m
"Set mainline version to
$NEXT_VERSION
-dev."
done_banner
()
{
local
VERSION
=
$1
local
PUSH
=
$2
echo
"========================================================================="
echo
"========================================================================="
echo
"Done"
echo
"Done"
echo
"========================================================================="
echo
"========================================================================="
echo
"Ready to release:"
echo
"Ready to release:"
echo
" capnproto-compiler-
$VERSION
.0-rc1
.tar.gz"
echo
" capnproto-compiler-
$VERSION
.tar.gz"
echo
" capnproto-c++-
$VERSION
.0-rc1
.tar.gz"
echo
" capnproto-c++-
$VERSION
.tar.gz"
echo
"Don't forget to push changes:"
echo
"Don't forget to push changes:"
echo
" git push origin master release-
$VERSION
.0"
echo
" git push origin
$PUSH
"
}
BRANCH
=
$(
git rev-parse
--abbrev-ref
HEAD
)
case
"
${
1
-
}
:
$BRANCH
"
in
# ======================================================================================
candidate:master
)
echo
"New major release."
if
[
$#
-gt
1
]
;
then
echo
"Cannot cherry-pick when starting from master. Do it yourself."
>
&2
exit
1
fi
HEAD_VERSION
=
$(
get_version
'^[0-9]+[.][0-9]+-dev$'
)
RELEASE_VERSION
=
${
HEAD_VERSION
%%-dev
}
.0
echo
"Version:
$RELEASE_VERSION
"
echo
"========================================================================="
echo
"Creating release branch..."
echo
"========================================================================="
doit git checkout
-b
release-
$RELEASE_VERSION
update_version
$HEAD_VERSION
$RELEASE_VERSION
-rc1
"release branch"
build_packages
$RELEASE_VERSION
-rc1
echo
"========================================================================="
echo
"Updating version in master branch..."
echo
"========================================================================="
doit git checkout master
declare
-a
VERSION_ARR
=(
${
RELEASE_VERSION
//./
}
)
NEXT_VERSION
=
${
VERSION_ARR
[0]
}
.
$((
VERSION_ARR[1]
+
1
))
update_version
$HEAD_VERSION
$NEXT_VERSION
-dev
"mainlaine"
done_banner
$RELEASE_VERSION
-rc1
"master release-
$RELEASE_VERSION
"
;;
;;
release-
*
)
# ======================================================================================
if
[
"x
${
1
:-}
"
==
xcandidate
]
;
then
candidate:release-
*
)
echo
"New release candidate."
echo
"New release candidate."
echo
"NOT IMPLEMENTED"
>
&2
OLD_VERSION
=
$(
get_release_version
)
exit
1
elif
[
"x
${
1
:-}
"
==
xfinal
]
;
then
if
[[
$OLD_VERSION
==
*
-rc
*
]]
;
then
# New release candidate for existing release.
RC
=
${
OLD_VERSION
##*-rc
}
BRANCH_VERSION
=
${
OLD_VERSION
%%-rc*
}
RC_VERSION
=
$BRANCH_VERSION
-rc
$((
RC
+
1
))
echo
"Version:
$RC_VERSION
"
else
# New micro release.
declare
-a
VERSION_ARR
=(
${
OLD_VERSION
//./
}
)
BRANCH_VERSION
=
${
VERSION_ARR
[0]
}
.
${
VERSION_ARR
[1]
}
.
$((
VERSION_ARR[2]
+
1
))
RC_VERSION
=
$BRANCH_VERSION
-rc1
echo
"Version:
$RC_VERSION
"
echo
"========================================================================="
echo
"Creating new release branch..."
echo
"========================================================================="
doit git checkout
-b
release-
$BRANCH_VERSION
fi
echo
"========================================================================="
echo
"Updating version number to
$RC_VERSION
..."
echo
"========================================================================="
update_version
$OLD_VERSION
$RC_VERSION
"release branch"
cherry_pick
"
$@
"
build_packages
$RC_VERSION
done_banner
$RC_VERSION
release-
$BRANCH_VERSION
;;
# ======================================================================================
final:release-
*
)
echo
"Final release."
echo
"Final release."
echo
"NOT IMPLEMENTED"
>
&2
OLD_VERSION
=
$(
get_release_version
)
if
[[
$OLD_VERSION
!=
*
-rc
*
]]
;
then
echo
"Current version is already a final release. You need to create a new candidate first."
>
&2
exit
1
fi
if
[
$#
-gt
1
]
;
then
echo
"Cannot cherry-pick into final release. Make another candidate."
>
&2
exit
1
exit
1
fi
RC
=
${
OLD_VERSION
##*-rc
}
NEW_VERSION
=
${
OLD_VERSION
%%-rc*
}
echo
"Version:
$NEW_VERSION
"
echo
"========================================================================="
echo
"Updating version number to
$NEW_VERSION
..."
echo
"========================================================================="
update_version
$OLD_VERSION
$NEW_VERSION
"release branch"
build_packages
$NEW_VERSION
done_banner
$NEW_VERSION
release-
$NEW_VERSION
;;
# ======================================================================================
retry:release-
*
)
echo
"Retrying release."
OLD_VERSION
=
$(
get_release_version
)
echo
"Version:
$OLD_VERSION
"
if
[[
$OLD_VERSION
==
*
-rc
*
]]
;
then
# We can add more cherry-picks when retrying a candidate.
cherry_pick
"
$@
"
else
else
echo
"Parameter must be either 'candidate' or 'final'."
>
&2
if
[
$#
-gt
1
]
;
then
echo
"Cannot cherry-pick into final release. Make another candidate."
>
&2
exit
1
exit
1
fi
fi
fi
OLD_VERSION
=
$(
get_release_version
)
build_packages
$OLD_VERSION
done_banner
$OLD_VERSION
release-
$OLD_VERSION
;;
# ======================================================================================
*
:master
)
echo
"Invalid command for mainline branch. Only command is 'candidate'."
>
&2
exit
1
;;
*
:release-
*
)
echo
"Invalid command for release branch. Commands are 'candidate', 'final', and 'retry'."
>
&2
exit
1
;;
;;
*
)
*
)
echo
"Not a master or release branch."
>
&2
echo
"Not a master or release branch."
>
&2
exit
1
exit
1
;;
esac
esac
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment