Skip to content

Commit

Permalink
CI: Use a script to get the latest version of baton. (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreer authored Feb 28, 2024
1 parent 0257dda commit f573758
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
# PGPASSWORD: secretpassword
# run: psql -h localhost --user postgres -f test/ci.sql
- name: Install baton
run: wget https://github.com/ConductorOne/baton/releases/download/v0.1.2/baton-v0.1.2-linux-amd64.tar.gz && tar xzf baton-v0.1.2-linux-amd64.tar.gz && mv baton /usr/local/bin
run: ./scripts/get-baton.sh && mv baton /usr/local/bin
- name: Build baton-postgresql
run: go build ./cmd/baton-postgresql
- name: Run baton-postgresql
Expand Down
19 changes: 19 additions & 0 deletions scripts/get-baton.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

set -euxo pipefail

OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
if [ "${ARCH}" = "x86_64" ]; then
ARCH="amd64"
fi

RELEASES_URL="https://api.github.com/repos/conductorone/baton/releases/latest"
BASE_URL="https://github.com/conductorone/baton/releases/download"

DOWNLOAD_URL=$(curl "${RELEASES_URL}" | jq --raw-output ".assets[].browser_download_url | match(\"${BASE_URL}/v[.0-9]+/baton-v[.0-9]+-${OS}-${ARCH}.*\"; \"i\").string")

FILENAME=$(basename ${DOWNLOAD_URL})

curl -LO ${DOWNLOAD_URL}
tar xzf ${FILENAME}

0 comments on commit f573758

Please sign in to comment.