diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 78c3499..f45659d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,14 +10,14 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: asdf-vm/actions/install@v3 - 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: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 454ce7a..e410d54 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,6 @@ jobs: release-please: runs-on: ubuntu-latest steps: - - uses: GoogleCloudPlatform/release-please-action@v3 + - uses: GoogleCloudPlatform/release-please-action@v4 with: release-type: simple diff --git a/README.md b/README.md index 348540d..af35fe9 100644 --- a/README.md +++ b/README.md @@ -15,10 +15,7 @@ # Dependencies -**TODO: adapt this section** - - `bash`, `curl`, `tar`, and [POSIX utilities](https://pubs.opengroup.org/onlinepubs/9699919799/idx/utilities.html). -- `SOME_ENV_VAR`: set this environment variable in your shell config to load the correct version of tool x. # Install diff --git a/bin/download b/bin/download index c11ee53..d4edcd3 100755 --- a/bin/download +++ b/bin/download @@ -10,14 +10,13 @@ source "${plugin_dir}/lib/utils.bash" mkdir -p "$ASDF_DOWNLOAD_PATH" -# TODO: Adapt this to proper extension and adapt extracting strategy. release_file="$ASDF_DOWNLOAD_PATH/$TOOL_NAME-$ASDF_INSTALL_VERSION.tar.gz" # Download tar.gz file to the download directory 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" diff --git a/contributing.md b/contributing.md index 0174178..22d84c5 100644 --- a/contributing.md +++ b/contributing.md @@ -5,8 +5,7 @@ Testing Locally: ```shell asdf plugin test [--asdf-tool-version ] [--asdf-plugin-gitref ] [test-command*] -# TODO: adapt this -asdf plugin test foundry-zksync https://github.com/caoer/asdf-foundry-zksync.git "forge --version" +asdf plugin test foundry-zksync https://github.com/placeholder-soft/foundry-zksync.git "forge --version" ``` Tests are automatically run in GitHub Actions on push and PR. diff --git a/lib/utils.bash b/lib/utils.bash index 2360850..a643511 100644 --- a/lib/utils.bash +++ b/lib/utils.bash @@ -2,8 +2,7 @@ set -euo pipefail -# TODO: Ensure this is the correct GitHub homepage where releases can be downloaded for foundry-zksync. -GH_REPO="https://github.com/placeholder-soft/foundry-zksync" +GH_REPO="https://github.com/matter-labs/foundry-zksync" TOOL_NAME="foundry-zksync" TOOL_TEST="forge --version" @@ -31,8 +30,6 @@ list_github_tags() { } list_all_versions() { - # TODO: Adapt this. By default we simply list the tag names from GitHub releases. - # Change this function if foundry-zksync has other means of determining installable versions. list_github_tags } @@ -40,9 +37,36 @@ download_release() { local version filename url version="$1" filename="$2" + # Determine platform and architecture + local platform + local arch + case "$(uname -s)" in + "Darwin") + platform="darwin" + ;; + "Linux") + platform="linux" + ;; + *) + fail "Unsupported platform: $(uname -s)" + ;; + esac - # TODO: Adapt the release URL convention for foundry-zksync - url="$GH_REPO/archive/v${version}.tar.gz" + case "$(uname -m)" in + "x86_64") + arch="amd64" + ;; + "arm64"|"aarch64") + arch="arm64" + ;; + *) + fail "Unsupported architecture: $(uname -m)" + ;; + esac + + # Construct download URL using platform and arch + local archive_name="foundry_nightly_${platform}_${arch}.tar.gz" + url="$GH_REPO/releases/download/$version/$archive_name" echo "* Downloading $TOOL_NAME release $version..." curl "${curl_opts[@]}" -o "$filename" -C - "$url" || fail "Could not download $url" @@ -61,7 +85,6 @@ install_version() { mkdir -p "$install_path" cp -r "$ASDF_DOWNLOAD_PATH"/* "$install_path" - # TODO: Assert foundry-zksync 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."