-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Testing Install Solana CI action changes
- Loading branch information
1 parent
2ec26ec
commit 1fee3fd
Showing
2 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters