Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update installation and release scripts to use asdf #669

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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