Skip to content

Commit

Permalink
fix: install supported Terramate system/arch.
Browse files Browse the repository at this point in the history
Signed-off-by: i4k <[email protected]>
  • Loading branch information
i4ki committed Sep 13, 2024
1 parent b5d1461 commit 349e286
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 6 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ jobs:

asdf:
name: Terramate asdf
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
version: [0.4.2, 0.4.3, skip]
steps:
- name: Checkout
Expand Down Expand Up @@ -60,9 +61,10 @@ jobs:

wrapper:
name: Terramate with wrapper
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
version: [0.4.3, latest]
steps:
- name: Checkout
Expand All @@ -87,9 +89,10 @@ jobs:

no-wrapper:
name: Terramate without wrapper
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest"]
version: [0.4.3, latest]
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ The [`terramate-io/terramate-action`] is a GitHub composite action that sets up
- It installs a wrapper script by default so that calls to `terramate` binary will expose GitHub Action outputs to access the `stderr`, `stderr`, and the `exitcode` of the `terramate` execution.
- It allows you to configure a default [Terramate Cloud] organization to use Terramate Cloud Features like Drift Detection and Stack Health Information.

## Compatbility
## Compatibility

The action currently only supports `ubuntu` runners.
The action currently only supports `ubuntu` and `macos` runners.
Please open an issue, if more runner support is required.

## Usage
Expand Down
24 changes: 23 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,29 @@ install() {
tmpdir=$(mktemp -d)
echo >&2 "install: Created tmp directory at ${tmpdir}"

url="https://github.com/terramate-io/terramate/releases/download/v${version}/terramate_${version}_linux_x86_64.tar.gz"
system=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)

if ! [[ "${system}" =~ ^(linux|darwin)$ ]]; then
echo >&2 "install: Unsupported system ${system}."
exit 1
fi

case "${arch}" in
x86_64|x64) arch=x86_64 ;;
aarch64|arm64) arch=arm64 ;;
i386|i686) arch=i386 ;;
*) echo >&2 "install: Unsupported architecture ${arch}." && exit 1 ;;
esac

if [ "${system}" == "darwin" ] && [ "${arch}" == "i386" ] ; then
echo >&2 "install: Unsupported architecture: darwin/i386"
exit 1
fi

echo >&2 "install: Downloading terramate binary for ${system}/${arch}"

url="https://github.com/terramate-io/terramate/releases/download/v${version}/terramate_${version}_${system}_${arch}.tar.gz"

status=$(curl -w "%{http_code}" -o "${tmpdir}/terramate.tar.gz" -L "${url}")
if [ "${status}" != "200" ] ; then
Expand Down

0 comments on commit 349e286

Please sign in to comment.