Skip to content

Commit

Permalink
Support yj's updated download filename
Browse files Browse the repository at this point in the history
As of `yj` 5.1.0+ the filename of the asset attached to the GitHub release
is now `yj-linux-arm64` instead of `yj-linux`.

This change ensures that the new yj default (as of #164) is able to be
downloaded, since currently the action fails with:

```
Installing yj 5.1.0
curl: (22) The requested URL returned error: 404
Error: Process completed with exit code 22.
```

The bash string comparison of the semver version isn't ideal, but it
doesn't feel worth adding further complexity given that:
- all `yj` releases so far use a full semver version (and not say an `X.Y` version)
- `yj` major releases are infrequent, so it's going to be a while before v10 is out
  (which would break the comparison) - by which point this backwards compatibiluty
  comparison can just be removed (and support for pre 5.1.0 removed).
  • Loading branch information
edmorley committed Jan 3, 2023
1 parent 7fc3d67 commit 66a27c6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion setup-tools/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ runs:
YJ_VERSION=${{ inputs.yj-version }}
echo "Installing yj ${YJ_VERSION}"
if [[ "${YJ_VERSION}" < "5.1.0" ]]; then
YJ_DOWNLOAD_FILENAME="yj-linux"
else
YJ_DOWNLOAD_FILENAME="yj-linux-amd64"
fi
curl \
--show-error \
--silent \
Expand All @@ -49,5 +54,5 @@ runs:
--connect-timeout 5 \
--max-time 60 \
--output "${HOME}/bin/yj" \
"https://github.com/sclevine/yj/releases/download/v${YJ_VERSION}/yj-linux"
"https://github.com/sclevine/yj/releases/download/v${YJ_VERSION}/${YJ_DOWNLOAD_FILENAME}"
chmod +x "${HOME}"/bin/yj

0 comments on commit 66a27c6

Please sign in to comment.