Skip to content

Commit

Permalink
ci: more tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Oct 7, 2024
1 parent 7366219 commit 7cea5a2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#!/bin/bash
# set -eou pipefail
set -eou pipefail

if [[ -z "${GITHUB_TOKEN}" ]]; then
GITHUB_FLAGS=""
else
GITHUB_FLAGS="--header \"Authorization: Bearer $GITHUB_TOKEN\" --header \"X-GitHub-Api-Version: 2022-11-28\""
fi

# Get the latest release
RELEASE_API_URL="https://api.github.com/repos/extism/python-pdk/releases/latest"
response=$(curl -s "$RELEASE_API_URL")
response=$(curl $GITHUB_FLAGS -s "$RELEASE_API_URL")
if [ -z "$response" ]; then
echo "Error: Failed to fetch the latest release from GitHub API."
exit 1
Expand Down Expand Up @@ -114,8 +120,8 @@ if curl -fsSL --output /tmp/extism-py.tar.gz "$DOWNLOAD_URL"; then
tar xzf /tmp/extism-py.tar.gz -C /tmp

if [ "$USE_SUDO" = "1" ]; then
sudo mkdir -p /usr/local/share
echo "No user-writable bin directory found in PATH. Using sudo to install in $INSTALL_DIR"
sudo mkdir -p /usr/local/share
sudo rm -rf /usr/local/share/extism-py
sudo mv /tmp/extism-py/bin/extism-py "$TARGET"
sudo mv /tmp/extism-py/share/extism-py /usr/local/share
Expand Down

0 comments on commit 7cea5a2

Please sign in to comment.