Skip to content
Snippets Groups Projects
Commit edbe3b9f authored by Ludovic Claude's avatar Ludovic Claude
Browse files

Improve publish script

parent fd2ff4dc
No related branches found
No related tags found
No related merge requests found
......@@ -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
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