Skip to content

Commit

Permalink
Testing Install Solana CI action changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lorisleiva committed Jul 30, 2024
1 parent 2ec26ec commit 1fee3fd
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 1 deletion.
65 changes: 65 additions & 0 deletions .github/actions/install-solana/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Install Solana

inputs:
version:
description: The Solana version to install
required: true
default: 'stable'
cache:
description: Whether the downloaded Solana release should be cached
required: true
default: 'true'
base_url:
description: The base URL to download the Solana release from — e.g. https://release.solana.com.
required: false

runs:
using: 'composite'
steps:
- name: Cache Solana
id: cache
if: inputs.cache == 'true'
uses: actions/cache@v4
with:
path: |
~/.local/share/solana/install/releases/${{ inputs.version }}
~/.cache/solana
key: ${{ runner.os }}-solana-v${{ inputs.version }}

- name: Resolve Base URL
id: base_url
run: |
if [ "${{ inputs.base_url }}" != "" ]; then
echo "base_url='${{ inputs.base_url }}'" >> $GITHUB_OUTPUT
else
cutoff="1.18.19"
desired="${{ inputs.version }}"
if [ "$(printf '%s\n' "$cutoff" "$desired" | sort -V | head -n1)" = "$desired" ] && [ "$cutoff" != "$desired" ]; then
echo "base_url='https://release.solana.com'" >> $GITHUB_OUTPUT
else
echo "base_url='https://release.anza.xyz'" >> $GITHUB_OUTPUT
fi
fi
shell: bash

- name: Install Solana
if: inputs.cache != 'true' || steps.cache.outputs.cache-hit != 'true'
run: |
sh -c "$(curl -sSfL ${{ steps.base_url.outputs.base_url }}/v${{ inputs.version }}/install)"
shell: bash

- name: Set Active Solana Version
run: |
rm -f "$HOME/.local/share/solana/install/active_release"
ln -s "$HOME/.local/share/solana/install/releases/${{ inputs.version }}/solana-release" "$HOME/.local/share/solana/install/active_release"
shell: bash

- name: Add Solana bin to Path
run: |
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
shell: bash

- name: Verify Solana install
run: |
solana --version
shell: bash
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ runs:

- name: Install Solana
if: ${{ inputs.solana == 'true' }}
uses: metaplex-foundation/actions/install-solana@v1
uses: ./.github/actions/install-solana
with:
version: ${{ env.SOLANA_VERSION }}
cache: true
Expand Down

0 comments on commit 1fee3fd

Please sign in to comment.