Skip to content
Snippets Groups Projects
Commit c6e2f1d5 authored by Mirco's avatar Mirco
Browse files

update publish and build scripts

parent da13deaa
No related branches found
No related tags found
No related merge requests found
......@@ -11,4 +11,3 @@ search = <version>{current_version}</version><!-- BUMP_VERSION -->
replace = <version>{new_version}</version><!-- BUMP_VERSION -->
[bumpversion:file:hbp.yml]
......@@ -18,6 +18,11 @@ get_script_dir () {
cd "$(get_script_dir)"
if pgrep -lf sshuttle > /dev/null ; then
echo "sshuttle detected. Please close this program as it messes with networking and prevents builds inside Docker to work"
exit 1
fi
if [[ $NO_SUDO || -n "$CIRCLECI" ]]; then
CAPTAIN="captain"
elif groups $USER | grep &>/dev/null '\bdocker\b'; then
......
#!/usr/bin/env bash
set -e
set -o pipefail # trace ERR through pipes
set -o errtrace # trace ERR through 'time command' and other functions
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
get_script_dir () {
SOURCE="${BASH_SOURCE[0]}"
......@@ -20,15 +23,21 @@ if pgrep -lf sshuttle > /dev/null ; then
exit 1
fi
if groups $USER | grep &>/dev/null '\bdocker\b'; then
if [ $NO_SUDO ]; then
CAPTAIN="captain"
DOCKER="docker"
elif groups $USER | grep &>/dev/null '\bdocker\b'; then
CAPTAIN="captain"
DOCKER="docker"
else
CAPTAIN="sudo captain"
DOCKER="sudo docker"
fi
# Build
echo "Build the project..."
./build.sh
./test.sh
echo "[ok] Done"
count=$(git status --porcelain | wc -l)
......@@ -59,8 +68,8 @@ select_part() {
git pull --tags
# Look for a version tag in Git. If not found, ask the user to provide one
[ $(git tag --points-at HEAD | wc -l) == 1 ] || (
latest_version=$( (bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,) || echo '0.0.1')
[ $(git tag --points-at HEAD | grep portal-backend | wc -l) == 1 ] || (
latest_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",, || echo '0.0.1')
echo
echo "Current commit has not been tagged with a version. Latest known version is $latest_version."
echo
......@@ -85,14 +94,13 @@ updated_version=$(bumpversion --dry-run --list patch | grep current_version | se
# Build again to update the version
echo "Build the project for distribution..."
./build.sh
echo "[ok] Done"
git push
git push --tags
# Push on Docker Hub
# WARNING: Requires captain 1.1.0 to push user tags
BUILD_DATE=$(date --iso-8601=seconds) \
BUILD_DATE=$(date -Iseconds) \
VCS_REF=$updated_version \
VERSION=$updated_version \
WORKSPACE=$WORKSPACE \
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment