Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opensilecs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
silecs
opensilecs
Commits
fdea9c2f
Commit
fdea9c2f
authored
7 years ago
by
al.schwinn
Browse files
Options
Downloads
Patches
Plain Diff
create tags / branches with release-script
parent
9588c066
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
silecs-communication-cpp/releaseSilecs.sh
+93
-15
93 additions, 15 deletions
silecs-communication-cpp/releaseSilecs.sh
with
93 additions
and
15 deletions
silecs-communication-cpp/releaseSilecs.sh
+
93
−
15
View file @
fdea9c2f
...
...
@@ -3,18 +3,76 @@
# $ source releaseSilecs.sh
#
# release a new version v1.0.0
# $ release 1.0.0 /
common/usr/cscofe/silecs /home/bel/schwinn/lnx/git
# $ release 1.0.0 /
home/bel/schwinn/lnx/git /common/usr/cscofe/silecs
#
# patch
2
packages of an existing version 1.2.3
# $ patch silecs-codegen 1.2.
4 1.2.3 /common/usr/cscofe/silecs /home/bel/schwinn/lnx/git
# $ patch silecs-model 1.2.
4 1.2.3 /common/usr/cscofe/silecs /home/bel/schwinn/lnx/git
# patch
two
packages of an existing version 1.2.3
, resulting of a installation of 1.2.4
# $ patch silecs-codegen 1.2.
3 /home/bel/schwinn/lnx/git /common/usr/cscofe/silecs
# $ patch silecs-model 1.2.
3 /home/bel/schwinn/lnx/git /common/usr/cscofe/silecs
#
# release a new version of the silecs-eclipse plugin
# $ plugin_release
/common/usr/cscofe/silecs
/home/bel/schwinn/lnx/git-silecs-plugin
# $ plugin_release /home/bel/schwinn/lnx/git-silecs-plugin
/common/usr/cscofe/silecs
# List of silecs packages which can be released or patched
PACKAGES
=
"silecs-codegen silecs-model silecs-communication-cpp silecs-diagnostic-cpp silecs-cli-client snap7"
# branch to release
RELEASE_BRANCH
=
gsi
UPSTREAM
=
${
1
:-
'@{u}'
}
LOCAL
=
$(
git rev-parse @
)
REMOTE
=
$(
git rev-parse
"
$UPSTREAM
"
)
BASE
=
$(
git merge-base @
"
$UPSTREAM
"
)
validateBranch
()
{
REQUIRED_BRANCH
=
$1
CURRENT_BRANCH
=
$(
git branch |
grep
\*
|
cut
-d
' '
-f2
)
if
[
"
$CURRENT_BRANCH
"
!=
"
$REQUIRED_BRANCH
"
]
;
then
echo
"Error: Release only can be done if branch '
${
REQUIRED_BRANCH
}
' is checked out."
echo
"Installation cancelled."
return
1
fi
git fetch
if
[
$LOCAL
=
$REMOTE
]
;
then
echo
"branch is identical with remote"
return
0
elif
[
$LOCAL
=
$BASE
]
;
then
echo
"Error: Pull required on branch '
${
RELEASE_BRANCH
}
'"
echo
"Installation cancelled."
return
1
elif
[
$REMOTE
=
$BASE
]
;
then
echo
"Error: Push required on branch '
${
RELEASE_BRANCH
}
'"
echo
"Installation cancelled."
return
1
else
echo
"Error: branch '
${
RELEASE_BRANCH
}
' is diverged"
echo
"Installation cancelled."
return
1
fi
}
createAndPushReleaseBranch
()
{
BRANCH_NAME
=
$1
# TODO: check if already exists
git ls-remote
--heads
<remote-name>
${
BRANCH_NAME
}
|
wc
-l
git checkout
-b
${
BRANCH_NAME
}
git push
${
BRANCH_NAME
}
}
createAndPushTag
()
{
TAG_NAME
=
$1
# TODO: check if already exists
git ls-remote <remote-name> refs/tags/<TAG_NAME>
git tag
${
TAG_NAME
}
git push origin
${
TAG_NAME
}
}
# Check that folder exists, print proper error if not
checkFolderExists
()
{
...
...
@@ -30,8 +88,9 @@ checkFolderExists()
release
()
{
VERSION
=
$1
RELEASE_DIR_BASE
=
$2
WORKSPACE
=
$3
WORKSPACE
=
$2
RELEASE_DIR_BASE
=
$3
checkFolderExists
${
WORKSPACE
}
for
PACKAGE
in
$PACKAGES
;
do
...
...
@@ -52,8 +111,9 @@ plugin_release()
{
(
set
-e
RELEASE_DIR_BASE
=
$1
WORKSPACE
=
$2
WORKSPACE
=
$1
RELEASE_DIR_BASE
=
$2
PACKAGE
=
silecs-eclipse-plugin-update-site
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
checkFolderExists
${
WORKSPACE
}
/
${
PACKAGE
}
...
...
@@ -62,17 +122,35 @@ plugin_release()
return
0
)
}
increment_version
()
{
declare
-a
part
=(
${
1
//\./
}
)
declare
new
declare
-i
carry
=
1
for
((
CNTR
=
${#
part
[@]
}
-1
;
CNTR>
=
0
;
CNTR-
=
1
))
;
do
len
=
${#
part
[CNTR]
}
new
=
$((
part[CNTR]+carry
))
[
${#
new
}
-gt
$len
]
&&
carry
=
1
||
carry
=
0
[
$CNTR
-gt
0
]
&&
part[CNTR]
=
${
new
:
-len
}
||
part[CNTR]
=
${
new
}
done
new
=
"
${
part
[*]
}
"
echo
-e
"
${
new
// /.
}
"
}
# releases a specific package to release-dir. For all other packages symlinks to the base-version are generated
patch
()
{
PACKAGE_TO_PATCH
=
$1
NEW_VERSION
=
$2
BASE_VERSION
=
$3
RELEASE_DIR_BASE
=
$4
WORKSPACE
=
$5
BASE_VERSION
=
$2
WORKSPACE
=
$4
RELEASE_DIR_BASE
=
$5
checkFolderExists
${
WORKSPACE
}
NEW_VERSION
=
$(
increment_version
$BASE_VERSION
)
echo
"New version will be: '
$NEW_VERSION
'"
for
PACKAGE
in
$PACKAGES
;
do
INSTALL_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
NEW_VERSION
}
BASE_DIR
=
${
RELEASE_DIR_BASE
}
/
${
PACKAGE
}
/
${
BASE_VERSION
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment