-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpull.sh
More file actions
executable file
·37 lines (32 loc) · 1.25 KB
/
Copy pathpull.sh
File metadata and controls
executable file
·37 lines (32 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -euo pipefail
if [ -z "${GITHUB_REPOSITORY_OWNER:-}" ]; then
REPO_URL=$(git config --get remote.origin.url)
if [[ $REPO_URL =~ github\.com[:/]([^/]+)/([^/]+) ]]; then
REPO_NAME="${BASH_REMATCH[1]}/${BASH_REMATCH[2]%.git}"
REPO_NAME="$(echo "$REPO_NAME" | tr '[:upper:]' '[:lower:]')"
else
echo "Error: Unable to extract repository information from git URL." >&2
exit 1
fi
else
REPO_NAME="$(echo "$GITHUB_REPOSITORY_OWNER/$(basename "$(git rev-parse --show-toplevel)")" | tr '[:upper:]' '[:lower:]')"
fi
IMAGE_TAG="$(git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]' | tr '/' '-')"
case "$IMAGE_TAG" in HEAD|main|master) IMAGE_TAG="latest" ;; esac
IMAGE_PATH_PREFIX="ghcr.io/$REPO_NAME"
CONTAINER_TOOL="podman"
[[ "$*" == *"--docker"* ]] && CONTAINER_TOOL="docker"
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
armv7l) ARCH="arm/v7" ;;
armv6l) ARCH="arm/v6" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
PLATFORM="${PLATFORM:-${OS}/${ARCH}}"
for name in gs satellite-recorder ax100-decoder waterfall satdump-decoder; do
$CONTAINER_TOOL pull --platform "$PLATFORM" "$IMAGE_PATH_PREFIX/$name:$IMAGE_TAG"
done