Skip to content

Commit

Permalink
Update installation and release scripts to use asdf for elixir and er…
Browse files Browse the repository at this point in the history
…lang version
  • Loading branch information
Neylix committed Nov 4, 2022
1 parent 438d66e commit 3012dae
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 15 deletions.
33 changes: 21 additions & 12 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ sudo apt-get install -y \
git \
zlib1g-dev \
libgmp-dev \
nodejs \
npm \
net-tools
net-tools \
libncurses5-dev

sudo locale-gen en_US.UTF-8

Expand Down Expand Up @@ -58,19 +57,29 @@ echo "Install Erlang & Elixir"
export DEBIAN_FRONTEND=noninteractive
export LANG=en_US.UTF-8

wget -O $INSTALL_DIR/erlang-solutions_2.0_all.deb https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb
if [[ ! -d $HOME/.asdf ]]
then
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.2
fi

sudo dpkg -i $INSTALL_DIR/erlang-solutions_2.0_all.deb
echo '. $HOME/.asdf/asdf.sh' >> ~/.profile
echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.profile
source ~/.profile

sudo apt-get update
sudo apt-get install -y esl-erlang=1:24.*
asdf update

asdf plugin add erlang || :
asdf plugin add elixir || :

cd $SCRIPT_DIR/..

asdf install

mkdir -p ~/elixir
wget https://github.com/elixir-lang/elixir/releases/download/v1.14.1/elixir-otp-24.zip -O ~/elixir/Precompiled.zip
ELIXIR_VERSION=$(asdf current elixir 2>&1 | grep -o '\S*' | sed -n 2p)
ERLANG_VERSION=$(asdf current erlang 2>&1 | grep -o '\S*' | sed -n 2p)

unzip ~/elixir/Precompiled.zip -d ~/elixir
echo 'PATH=$PATH:~/elixir/bin' >> ~/.bashrc
source ~/.bashrc
asdf global elixir $ELIXIR_VERSION
asdf global erlang $ERLANG_VERSION

echo "Install Libsodium"

Expand Down
21 changes: 18 additions & 3 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,24 @@ do
done
shift $((OPTIND -1))

source ~/.profile

if [[ -d $HOME/.asdf ]]
then

SCRIPT_DIR=$(dirname $(readlink -f $0))

cd $SCRIPT_DIR/..

asdf install

ELIXIR_VERSION=$(asdf current elixir 2>&1 | grep -o '\S*' | sed -n 2p)
ERLANG_VERSION=$(asdf current erlang 2>&1 | grep -o '\S*' | sed -n 2p)

asdf global elixir $ELIXIR_VERSION
asdf global erlang $ERLANG_VERSION
fi

# Install updated versions of hex/rebar
mix local.rebar --force
mix local.hex --if-missing --force
Expand All @@ -49,9 +67,6 @@ export MIX_ENV=prod
mix deps.get

# Builds WEB assets in production mode
cd assets
npm ci
cd -
mix assets.saas
mix assets.deploy

Expand Down

0 comments on commit 3012dae

Please sign in to comment.