Skip to content

Instantly share code, notes, and snippets.

@pepeloper
Created June 21, 2026 15:36
Show Gist options
  • Select an option

  • Save pepeloper/18433880a0de7125f539aee463d75309 to your computer and use it in GitHub Desktop.

Select an option

Save pepeloper/18433880a0de7125f539aee463d75309 to your computer and use it in GitHub Desktop.
Shipyard private repository installer bootstrap
#!/usr/bin/env bash
set -Eeuo pipefail
REPOSITORY="${SHIPYARD_REPOSITORY:-pepeloper/shipyard}"
BRANCH="${SHIPYARD_BRANCH:-main}"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
read -r -s -p "GitHub token (repository read access): " GITHUB_TOKEN </dev/tty
echo
[ -n "$GITHUB_TOKEN" ] || {
echo "A GitHub token is required." >&2
exit 2
}
AUTH_CONFIG="${TMP_DIR}/curl-auth.conf"
printf 'header = "Authorization: Bearer %s"\nheader = "User-Agent: shipyard-installer"\nheader = "X-GitHub-Api-Version: 2022-11-28"\n' \
"$GITHUB_TOKEN" > "$AUTH_CONFIG"
chmod 600 "$AUTH_CONFIG"
curl -fsSL --config "$AUTH_CONFIG" \
-H 'Accept: application/vnd.github.raw+json' \
"https://api.github.com/repos/${REPOSITORY}/contents/install/install.sh?ref=${BRANCH}" \
-o "${TMP_DIR}/install.sh"
chmod 700 "${TMP_DIR}/install.sh"
rm -f "$AUTH_CONFIG"
exec 3<<<"$GITHUB_TOKEN"
unset GITHUB_TOKEN
bash "${TMP_DIR}/install.sh" --github-token-fd 3 "$@"
exec 3<&-
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment