2021-12-19 09:53:19 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Setup environment
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
SCRIPT_NAME=`basename "$0"`
|
|
|
|
JOPLIN_ROOT_DIR="$SCRIPT_DIR/../.."
|
|
|
|
JOPLIN_WEBSITE_ROOT_DIR="$JOPLIN_ROOT_DIR/../joplin-website"
|
|
|
|
|
2021-12-19 11:23:49 +02:00
|
|
|
echo "IS_CONTINUOUS_INTEGRATION=$IS_CONTINUOUS_INTEGRATION"
|
|
|
|
echo "GIT_USER_NAME=$GIT_USER_NAME"
|
|
|
|
|
|
|
|
if [[ "$IS_CONTINUOUS_INTEGRATION" == "1" ]]; then
|
|
|
|
echo "Running on CI - setting up Git username and email"
|
|
|
|
git config --global user.email "$GIT_USER_EMAIL"
|
|
|
|
git config --global user.name "$GIT_USER_NAME"
|
2021-12-19 11:25:34 +02:00
|
|
|
else
|
2021-12-19 11:23:49 +02:00
|
|
|
echo "*Not* running on CI - using the global Git username and email"
|
|
|
|
fi
|
|
|
|
|
2021-12-19 09:53:19 +02:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Update the Markdown files inside the Joplin directory. This is for example the
|
|
|
|
# download links README.md or the desktop app changelog.
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cd "$JOPLIN_ROOT_DIR"
|
|
|
|
|
|
|
|
# Will fail if there's any local change in the repo, which is what we want
|
2021-12-19 11:39:29 +02:00
|
|
|
git checkout dev
|
2021-12-19 09:53:19 +02:00
|
|
|
git pull --rebase
|
|
|
|
|
2021-12-20 17:08:43 +02:00
|
|
|
yarn install
|
2021-12-19 09:53:19 +02:00
|
|
|
|
2021-12-20 17:08:43 +02:00
|
|
|
# Historically, that was to clean npm's package-lock mess, but it should no
|
|
|
|
# longer be necessary for Yarn. Leaving it anyway since we don't want anything
|
|
|
|
# to change after installation.
|
2021-12-19 09:53:19 +02:00
|
|
|
git reset --hard
|
|
|
|
|
2021-12-20 17:08:43 +02:00
|
|
|
yarn run updateMarkdownDoc
|
2021-12-19 09:53:19 +02:00
|
|
|
|
|
|
|
# We commit and push the change. It will be a noop if nothing was actually
|
|
|
|
# changed
|
|
|
|
|
|
|
|
git add -A
|
|
|
|
|
|
|
|
git commit -m "Doc: Updated Markdown files
|
|
|
|
|
2021-12-19 11:49:00 +02:00
|
|
|
Auto-updated using $SCRIPT_NAME" || true
|
2021-12-19 09:53:19 +02:00
|
|
|
|
|
|
|
git pull --rebase
|
|
|
|
git push
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Build and deploy the website
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
cd "$JOPLIN_WEBSITE_ROOT_DIR"
|
2021-12-19 11:39:29 +02:00
|
|
|
git checkout master
|
2021-12-19 09:53:19 +02:00
|
|
|
git pull --rebase
|
|
|
|
|
|
|
|
cd "$JOPLIN_ROOT_DIR"
|
2021-12-20 17:08:43 +02:00
|
|
|
yarn run buildWebsite
|
2021-12-19 09:53:19 +02:00
|
|
|
|
|
|
|
cd "$JOPLIN_WEBSITE_ROOT_DIR"
|
|
|
|
git add -A
|
|
|
|
git commit -m "Updated website
|
|
|
|
|
2021-12-19 11:49:00 +02:00
|
|
|
Auto-updated using $SCRIPT_NAME" || true
|
2021-12-19 09:53:19 +02:00
|
|
|
|
|
|
|
git pull --rebase
|
|
|
|
git push
|