Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install script in release #25

Merged
merged 3 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/publish_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ jobs:
'release/x86_64-unknown-linux-gnu.tar.gz#Linux (x86_64)' \
'release/x86_64-unknown-linux-musl.tar.gz#Linux (x86_64, musl)' \
'release/aarch64-unknown-linux-gnu.tar.gz#Linux (arm64)' \
'release/aarch64-unknown-linux-musl.tar.gz#Linux (arm64, musl)'
'release/aarch64-unknown-linux-musl.tar.gz#Linux (arm64, musl)' \
'release/install.sh#Installer script'
env:
GH_TOKEN: ${{github.token}}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
The easiest way to get `appsignal-wrap` in your machine is to run our installation one-liner:

```sh
curl -sSL https://raw.githubusercontent.com/appsignal/appsignal-wrap/refs/heads/main/install.sh | sh
curl -sSL https://github.com/appsignal/appsignal-wrap/releases/latest/download/install.sh | sh
```

You'll need to run it with super-user privileges -- if you're not running this as root, prefix it with `sudo`.
Expand Down
15 changes: 10 additions & 5 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ if ! command -v tar >/dev/null; then
exit 1
fi

VERSION="${APPSIGNAL_WRAP_VERSION:-"latest"}"
LAST_RELEASE="0.1.1"

VERSION="${APPSIGNAL_WRAP_VERSION:-"$LAST_RELEASE"}"
INSTALL_FOLDER="${APPSIGNAL_WRAP_INSTALL_FOLDER:-"/usr/local/bin"}"

# Expected values are "linux" or "darwin".
Expand Down Expand Up @@ -61,6 +63,7 @@ if [ "$OS" = "linux" ]; then
EXTRA="musl"
EXTRA_FRIENDLY="musl"
else
# Do not add "gnu" to the friendly triple, as it is the assumed default.
EXTRA="gnu"
fi
fi
Expand All @@ -72,19 +75,21 @@ else
fi

if [ -z "$EXTRA_FRIENDLY" ]; then
FRIENDLY="${OS_FRIENDLY} (${ARCH_FRIENDLY})"
TRIPLE_FRIENDLY="${OS_FRIENDLY} (${ARCH_FRIENDLY})"
else
FRIENDLY="${OS_FRIENDLY} (${ARCH_FRIENDLY}, ${EXTRA_FRIENDLY})"
TRIPLE_FRIENDLY="${OS_FRIENDLY} (${ARCH_FRIENDLY}, ${EXTRA_FRIENDLY})"
fi

echo "Downloading $VERSION version of the \`appsignal-wrap\` binary for $FRIENDLY..."

if [ "$VERSION" = "latest" ]; then
URL="https://github.com/appsignal/appsignal-wrap/releases/latest/download/$TRIPLE.tar.gz"
VERSION_FRIENDLY="latest version"
else
URL="https://github.com/appsignal/appsignal-wrap/releases/download/v$VERSION/$TRIPLE.tar.gz"
VERSION_FRIENDLY="version $VERSION"
fi

echo "Downloading $VERSION_FRIENDLY of the \`appsignal-wrap\` binary for $TRIPLE_FRIENDLY..."

curl --progress-bar -SL "$URL" | tar -C "$INSTALL_FOLDER" -xz

echo "Done! Installed \`appsignal-wrap\` binary at \`$INSTALL_FOLDER/appsignal-wrap\`."
2 changes: 2 additions & 0 deletions script/build_artifacts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ script/build_artifact x86_64-unknown-linux-gnu
script/build_artifact x86_64-unknown-linux-musl
script/build_artifact aarch64-unknown-linux-gnu
script/build_artifact aarch64-unknown-linux-musl

cp install.sh release/
5 changes: 5 additions & 0 deletions script/write_version
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ File.write(
"Cargo.toml",
File.read("Cargo.toml").sub(/^version = ".*"$/, %(version = "#{VERSION}"))
)

File.write(
"install.sh",
File.read("install.sh").sub(/^LAST_RELEASE=".*"$/, %(LAST_RELEASE="#{VERSION}"))
)