|
| 1 | +name: 'Install Erlang OTP and rebar3' |
| 2 | +description: 'Installs a specific version of Erlang OTP and rebar3' |
| 3 | +inputs: |
| 4 | + otp_version: |
| 5 | + description: 'The OTP version to install' |
| 6 | + required: false |
| 7 | + default: '25.3.2.19' |
| 8 | + rebar_version: |
| 9 | + description: 'The rebar3 version to install' |
| 10 | + required: false |
| 11 | + default: '174fd9070195443d693d444ecd1f2b7aa91661fe' # 3.18.0 |
| 12 | +runs: |
| 13 | + using: "composite" |
| 14 | + steps: |
| 15 | + |
| 16 | + - name: Install kerl |
| 17 | + shell: bash |
| 18 | + run: | |
| 19 | + curl -s https://raw.githubusercontent.com/kerl/kerl/master/kerl > /tmp/kerl |
| 20 | + chmod a+x /tmp/kerl |
| 21 | +
|
| 22 | + - name: Install Erlang OTP and rebar3 |
| 23 | + shell: bash |
| 24 | + run: | |
| 25 | + # Build and install Erlang |
| 26 | + /tmp/kerl build ${{ inputs.otp_version }} ${{ inputs.otp_version }} |
| 27 | + /tmp/kerl install ${{ inputs.otp_version }} ~/otp/${{ inputs.otp_version }} |
| 28 | + # This will make the erlang version available to the current shell. |
| 29 | + . ~/otp/${{ inputs.otp_version }}/activate |
| 30 | + # Persist to the github actions path for use in future steps. |
| 31 | + echo "$HOME/otp/${{ inputs.otp_version }}/bin" >> "$GITHUB_PATH" |
| 32 | +
|
| 33 | + # Install specific rebar3 version |
| 34 | + cd ~/ |
| 35 | + git clone https://github.com/erlang/rebar3.git |
| 36 | + cd rebar3 |
| 37 | + git checkout ${{ matrix.versions.rebar }} |
| 38 | + ./bootstrap |
| 39 | + ./rebar3 local install |
| 40 | +
|
| 41 | + # Add to the path for use in this step. |
| 42 | + export PATH=$HOME/otp/${{ inputs.otp_version }}/.cache/rebar3/bin:$PATH |
| 43 | + # Persist to the github actions path for use in future steps. |
| 44 | + echo "$HOME/otp/${{ inputs.otp_version }}/.cache/rebar3/bin" >> "$GITHUB_PATH" |
| 45 | +
|
| 46 | + # Verify installation |
| 47 | + echo "Installed Erlang version:" |
| 48 | + erl -noshell -eval 'io:format("~s~n", [erlang:system_info(otp_release)]), halt().' |
| 49 | + echo "Installed rebar3 version:" |
| 50 | + rebar3 --version |
0 commit comments