Skip to content

Commit

Permalink
chore: Bump checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
qbart committed Sep 16, 2023
1 parent bc1d9c3 commit 65b7b1d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ jobs:
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- name: asdf_plugin_test
uses: asdf-vm/actions/plugin-test@v2
with:
command: selleo version
- run: git clone https://github.com/asdf-vm/asdf.git
- run: . asdf/asdf.sh && asdf plugin add selleo https://github.com/selleo/asdf-cli.git
- run: . asdf/asdf.sh && asdf install selleo latest
- run: . asdf/asdf.sh && asdf global selleo latest
- name: test
run: . asdf/asdf.sh && selleo version
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: asdf-vm/actions/install@v2
- run: scripts/lint.bash

actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Check workflow files
uses: docker://rhysd/actionlint:1.6.23
with:
Expand Down
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,20 @@
Plugin:

```shell
asdf plugin add cli
# or
asdf plugin add cli https://github.com/selleo/asdf-cli.git
asdf plugin add selleo https://github.com/selleo/asdf-cli.git
```

cli:

```shell
# Show all installable versions
asdf list-all cli
asdf list-all selleo

# Install specific version
asdf install cli latest
asdf install selleo latest

# Set a version globally (on your ~/.tool-versions file)
asdf global cli latest
asdf global selleo latest

# Now cli commands are available
selleo version
Expand Down
2 changes: 1 addition & 1 deletion bin/download
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz"
download_release "$ASDF_INSTALL_VERSION" "$release_file"

# Extract contents of tar.gz file into the download directory
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" --strip-components=1 || fail "Could not extract $release_file"
tar -xzf "$release_file" -C "$ASDF_DOWNLOAD_PATH" || fail "Could not extract $release_file"

# Remove the tar.gz file since we don't need to keep it
rm "$release_file"
25 changes: 21 additions & 4 deletions lib/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ list_all_versions() {
}

download_release() {

local version filename url
version="$1"
filename="$2"

# TODO: Adapt the release URL convention for cli
url="$GH_REPO/archive/v${version}.tar.gz"
# FIXED: Adapt the release URL convention for cli
local -r platform="$(get_platform)"
local -r arch="$(get_arch)"
url="$GH_REPO/releases/download/v${version}/cli_${version}_${platform}_${arch}.tar.gz"

echo "* Downloading $TOOL_NAME release $version..."
curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url"
}

Expand All @@ -58,10 +60,12 @@ install_version() {
fi

(
local tool_cmd
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"

mkdir -p "$install_path"
cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path"

# TODO: Assert cli executable exists.
local tool_cmd
tool_cmd="$(echo "$TOOL_TEST" | cut -d' ' -f1)"
test -x "$install_path/$tool_cmd" || fail "Expected $install_path/$tool_cmd to be executable."
Expand All @@ -72,3 +76,16 @@ install_version() {
fail "An error occurred while installing $TOOL_NAME $version."
)
}

get_arch() {
local -r machine="$(uname -m)"
if [[ $machine == "arm64" ]] || [[ $machine == "aarch64" ]]; then
echo "arm64"
else
echo "amd64"
fi
}

get_platform() {
uname | tr '[:upper:]' '[:lower:]'
}

0 comments on commit 65b7b1d

Please sign in to comment.