2024-04-25 13:49:12 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
export XDG_RUNTIME_DIR=/run/user/$UID
|
|
|
|
export MIX_ENV=prod
|
|
|
|
|
|
|
|
basedir=$HOME/var/keila
|
|
|
|
release=`curl -Ls https://api.github.com/repos/pentacent/keila/releases/latest | jq -r '.tag_name'`
|
|
|
|
oldrelease=`$HOME/bin/keila version | cut -d " " -f2-`
|
|
|
|
tools=$basedir/.tool-versions
|
|
|
|
|
|
|
|
echo "=== Old Keila is at [ $oldrelease ], latest release is [ $release ] ==="
|
|
|
|
read -p "=> Reply yY to proceed..." -n 1 -r
|
|
|
|
echo
|
|
|
|
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
|
|
|
then
|
|
|
|
[[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $basedir
|
|
|
|
git fetch
|
|
|
|
git checkout $release
|
|
|
|
|
2024-12-20 13:17:29 +01:00
|
|
|
erlang_ver=$(grep "erlang" "$tools" | awk '{print $2}')
|
|
|
|
elixir_ver=$(grep "elixir" "$tools" | awk '{print $2}')
|
|
|
|
|
2024-04-25 13:49:12 +02:00
|
|
|
. "$HOME/.asdf/asdf.sh"
|
|
|
|
. "$HOME/.asdf/completions/asdf.bash"
|
|
|
|
|
|
|
|
asdf install erlang $erlang_ver
|
|
|
|
asdf install elixir $elixir_ver
|
|
|
|
|
|
|
|
systemctl stop --user keila
|
|
|
|
|
|
|
|
cd $basedir
|
|
|
|
|
|
|
|
mix local.hex --force
|
|
|
|
mix local.rebar --force
|
|
|
|
mix deps.get
|
|
|
|
mix deps.compile
|
|
|
|
|
|
|
|
npm ci --prefix ./assets
|
|
|
|
|
|
|
|
mix deps.clean mime --build
|
|
|
|
mix assets.deploy
|
|
|
|
mix release
|
|
|
|
|
|
|
|
systemctl start --user keila
|
|
|
|
|
|
|
|
sleep 2
|
|
|
|
|
2024-12-20 13:22:34 +01:00
|
|
|
systemctl status --user --no-pager keila
|
2024-04-25 13:49:12 +02:00
|
|
|
|