diff --git a/README.md b/README.md index 19b689cbb4..9da264abef 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,15 @@ Use GitHub Action: uses: stellar/stellar-cli@v23.0.1 ``` +When pinning the action to a full commit SHA, use the SHA in `uses` and +set the CLI release version explicitly: + +```yaml +uses: stellar/stellar-cli@ +with: + version: '23.0.1' +``` + Run with Docker: ```sh diff --git a/action.yml b/action.yml index 282192eaa2..b8b26890e3 100644 --- a/action.yml +++ b/action.yml @@ -4,9 +4,9 @@ description: "Install the stellar-cli" inputs: version: description: | - Recommended for use only in testing new versions of the action prior to - release. For regular use, use the version of the action corresponding to - the version of the stellar-cli that should be installed. + Stellar CLI release version to install, with or without a leading v. + Defaults to the action's release tag. Set this input when using a commit + SHA or other non-release ref. required: false runs: using: "composite" @@ -32,7 +32,11 @@ runs: id: version shell: bash run: | - version=`echo $VERSION | sed 's/v//'` + version="${VERSION#v}" + if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then + echo "::error::Set 'with.version' to a Stellar CLI release version (for example, '28.1.0') when using a commit SHA or another non-release ref." + exit 1 + fi echo "using version: $version" echo "version=$version" >> "$GITHUB_OUTPUT" env: