Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institut für Informatik
dbis
software
dbispipeline
Commits
329c5c04
Commit
329c5c04
authored
Mar 11, 2021
by
Benjamin Murauer
Browse files
added script for publishing
parent
c6cdb238
Pipeline
#42196
passed with stage
in 1 minute and 51 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
publish.sh
publish.sh
+50
-0
No files found.
publish.sh
0 → 100644
View file @
329c5c04
#!/bin/bash
BRANCH
=
$(
git branch
--show-current
)
if
[
"
${
BRANCH
}
"
!=
"master"
]
;
then
echo
"publishing can only be done on the master branch."
exit
1
fi
DIFFS_STRING
=
$(
git rev-list
--left-right
--count
master...origin/master
)
DIFFS
=(
$DIFFS_STRING
)
LOCAL
=
${
DIFFS
[0]
}
# how many commits local is ahead of origin
REMOTE
=
${
DIFFS
[1]
}
# how many commits origin is ahead of local
# if the master branch on origin is ahead, probably forgot to pull
if
[
"
${
REMOTE
}
"
!=
0
]
;
then
echo
"master branch is
${
REMOTE
}
commits ahead. Pull/merge first."
exit
1
fi
# make sure all tags are available locally
git fetch
--tags
LAST_TAG
=
$(
git describe
--tags
--abbrev
=
0
)
LAST_LOGS
=
$(
git log
--color
--pretty
=
oneline HEAD...
"
${
LAST_TAG
}
"
)
LAST_LOG_LINES
=
$(
echo
"
${
LAST_LOGS
}
"
|
wc
-l
)
# count the lines of commits between HEAD and the last named tag
if
[
"
${
LAST_LOG_LINES
}
"
==
0
]
;
then
echo
"No commits have been detected since the last tag
${
LAST_TAG
}
."
exit
1
fi
echo
"commits since last tag:"
echo
"-----------------------"
echo
"
${
LAST_LOGS
}
"
VERSION_LEVEL
=
$1
if
[
"
${
VERSION_LEVEL
}
"
!=
"patch"
]
&&
[
"
${
VERSION_LEVEL
}
"
!=
"minor"
]
;
then
echo
"Usage: ./publish.sh <patch|minor>"
exit
1
fi
bumpversion
"
${
VERSION_LEVEL
}
"
||
exit
1
VERSION
=
$(
python
-m
setup
--version
)
echo
"new version is:
${
VERSION
}
"
git add setup.cfg setup.py
git commit
-m
"release v
${
VERSION
}
"
git tag
"v
${
VERSION
}
"
git push origin
"v
${
VERSION
}
"
make release
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