2024-05-23 00:17:55 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2024-06-02 17:45:52 +02:00
|
|
|
export SRCDIR="$PWD"
|
2024-06-06 22:46:37 +02:00
|
|
|
export WEBAPP_DIR="$SRCDIR/platypush/backend/http/webapp"
|
2024-05-23 00:17:55 +02:00
|
|
|
export SKIPCI="$PWD/.skipci"
|
|
|
|
rm -rf "$SKIPCI"
|
|
|
|
|
|
|
|
. .drone/macros/configure-git.sh
|
|
|
|
|
2024-06-06 22:46:37 +02:00
|
|
|
cd "$WEBAPP_DIR"
|
2024-05-23 00:17:55 +02:00
|
|
|
if [ $(git log --pretty=oneline $DRONE_COMMIT_AFTER...$DRONE_COMMIT_BEFORE . | wc -l) -eq 0 ]; then
|
|
|
|
echo "No UI changes detected, skipping build"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$(git log --pretty=format:%s HEAD...HEAD~1 | head -1)" == "[Automatic] Updated UI files" ]; then
|
|
|
|
echo "UI changes have already been committed, skipping build"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf dist node_modules
|
|
|
|
npm install
|
|
|
|
npm run build
|
|
|
|
|
|
|
|
if [ $(git status --porcelain dist | wc -l) -eq 0 ]; then
|
|
|
|
echo "No build files have been changed"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Create a .skipci file to mark the fact that the next steps should be skipped
|
|
|
|
# (we're going to do another push anyway, so another pipeline will be triggered)
|
|
|
|
touch "$SKIPCI"
|
2024-06-02 17:45:52 +02:00
|
|
|
cd "$SRCDIR"
|
2024-05-23 00:17:55 +02:00
|
|
|
|
|
|
|
. .drone/macros/configure-ssh.sh
|
|
|
|
. .drone/macros/configure-gpg.sh
|
|
|
|
|
2024-06-06 22:46:37 +02:00
|
|
|
git add "${WEBAPP_DIR}/dist"
|
|
|
|
git commit "${WEBAPP_DIR}/dist" -S -m "[Automatic] Updated UI files" --no-verify
|
2024-05-23 00:17:55 +02:00
|
|
|
git remote rm origin
|
|
|
|
git remote add origin git@git.platypush.tech:platypush/platypush.git
|
|
|
|
git push -f origin master
|
|
|
|
|
|
|
|
# Restore the original git configuration
|
|
|
|
mv "$TMP_GIT_CONF" "$GIT_CONF"
|