forked from code-corps/code-corps-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircle_pre_build.sh
More file actions
executable file
·51 lines (40 loc) · 1.24 KB
/
circle_pre_build.sh
File metadata and controls
executable file
·51 lines (40 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# Ensure exit codes other than 0 fail the build
set -e
# Check for asdf
if ! asdf | grep version; then
# Install asdf into ~/.asdf if not previously installed
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.1.0
fi
# Add plugins (Erlang and Elixir) for asdf
# Check to see if asdf's Erlang plugin is installed
if ! asdf plugin-list | grep erlang; then
# Install the Erlang plugin
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
else
# Update the Erlang plugin
asdf plugin-update erlang
fi
# Check to see if asdf's Elixir plugin is installed
if ! asdf plugin-list | grep elixir; then
# Install the Elixir plugin
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
else
# Update the Elixir plugin
asdf plugin-update elixir
fi
# Extract versions from elixir_buildpack.config into variables
. elixir_buildpack.config
# Write .tool-versions for asdf
echo "erlang $erlang_version" >> .tool-versions
echo "elixir $elixir_version" >> .tool-versions
# Install erlang/elixir
echo "Installing Erlang..."
asdf install erlang $erlang_version
echo "Installing Elixir..."
asdf install elixir $elixir_version
# Get dependencies
yes | mix deps.get
yes | mix local.rebar
# Exit successfully
exit 0