diff --git a/publish.sh b/publish.sh index b5343580659d1ed9bf9531a5b677214221eadd45..ad8445155c3f756842a102d1de08c13e0a1c1f87 100755 --- a/publish.sh +++ b/publish.sh @@ -13,7 +13,7 @@ get_script_dir () { pwd } -export WORKSPACE=$(get_script_dir) +WORKSPACE=$(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" @@ -26,6 +26,11 @@ else CAPTAIN="sudo captain" fi +# Build +echo "Build the project..." +./build.sh +echo "[ok] Done" + count=$(git status --porcelain | wc -l) if test $count -gt 0; then git status @@ -76,14 +81,26 @@ git pull --tags fi ) +updated_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,) + +# Build again to update the version +echo "Build the project for distribution..." +./build.sh +echo "[ok] Done" + git push git push --tags -updated_version=$(bumpversion --dry-run --list patch | grep current_version | sed -r s,"^.*=",,) +# Push on Docker Hub # WARNING: Requires captain 1.1.0 to push user tags -BUILD_DATE=$(date --iso-8601=seconds) VCS_REF=$updated_version VERSION=$updated_version \ +BUILD_DATE=$(date --iso-8601=seconds) \ + VCS_REF=$updated_version \ + VERSION=$updated_version \ + WORKSPACE=$WORKSPACE \ $CAPTAIN push portal-backend --branch-tags=false --commit-tags=false --tag $updated_version + +# Notify on slack sed "s/USER/${USER^}/" $WORKSPACE/docker/runner/slack.json > $WORKSPACE/target/slack.json sed -i.bak "s/VERSION/$updated_version/" $WORKSPACE/target/slack.json curl -k -X POST --data-urlencode payload@$WORKSPACE/target/slack.json https://hbps1.chuv.ch/slack/dev-activity -rm -f $WORKSPACE/target/slack.json +rm -f $WORKSPACE/target/slack.json $WORKSPACE/target/slack.json.bak