mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-04-24 10:20:32 +00:00
update install scripts
This commit is contained in:
@@ -4,9 +4,11 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
# Configuration
|
||||
$Repo = "atcr-io/atcr"
|
||||
$BinaryName = "docker-credential-atcr.exe"
|
||||
$InstallDir = if ($env:ATCR_INSTALL_DIR) { $env:ATCR_INSTALL_DIR } else { "$env:ProgramFiles\ATCR" }
|
||||
$Version = "v0.0.1"
|
||||
$TagHash = "c6cfbaf1723123907f9d23e300f6f72081e65006"
|
||||
$TangledRepo = "https://tangled.org/@evan.jarrett.net/at-container-registry"
|
||||
|
||||
Write-Host "ATCR Credential Helper Installer for Windows" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
@@ -27,23 +29,14 @@ function Get-Architecture {
|
||||
$Arch = Get-Architecture
|
||||
Write-Host "Detected: Windows $Arch" -ForegroundColor Green
|
||||
|
||||
# Get latest release version
|
||||
function Get-LatestVersion {
|
||||
Write-Host "Fetching latest version..." -ForegroundColor Yellow
|
||||
$releaseUrl = "https://api.github.com/repos/$Repo/releases/latest"
|
||||
|
||||
try {
|
||||
$release = Invoke-RestMethod -Uri $releaseUrl -UseBasicParsing
|
||||
return $release.tag_name
|
||||
} catch {
|
||||
Write-Host "Failed to fetch latest version: $_" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
if ($env:ATCR_VERSION) {
|
||||
$Version = $env:ATCR_VERSION
|
||||
Write-Host "Using specified version: $Version" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "Using version: $Version" -ForegroundColor Green
|
||||
}
|
||||
|
||||
$Version = if ($env:ATCR_VERSION) { $env:ATCR_VERSION } else { Get-LatestVersion }
|
||||
Write-Host "Latest version: $Version" -ForegroundColor Green
|
||||
|
||||
# Download and install binary
|
||||
function Install-Binary {
|
||||
param (
|
||||
@@ -53,7 +46,7 @@ function Install-Binary {
|
||||
|
||||
$versionClean = $Version.TrimStart('v')
|
||||
$fileName = "docker-credential-atcr_${versionClean}_Windows_${Arch}.zip"
|
||||
$downloadUrl = "https://github.com/$Repo/releases/download/$Version/$fileName"
|
||||
$downloadUrl = "$TangledRepo/tags/$TagHash/download/$fileName"
|
||||
|
||||
Write-Host "Downloading from: $downloadUrl" -ForegroundColor Yellow
|
||||
|
||||
|
||||
@@ -11,9 +11,11 @@ YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
REPO="atcr-io/atcr"
|
||||
BINARY_NAME="docker-credential-atcr"
|
||||
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
|
||||
VERSION="v0.0.1"
|
||||
TAG_HASH="c6cfbaf1723123907f9d23e300f6f72081e65006"
|
||||
TANGLED_REPO="https://tangled.org/@evan.jarrett.net/at-container-registry"
|
||||
|
||||
# Detect OS and architecture
|
||||
detect_platform() {
|
||||
@@ -47,23 +49,11 @@ detect_platform() {
|
||||
esac
|
||||
}
|
||||
|
||||
# Get latest release version
|
||||
get_latest_version() {
|
||||
echo -e "${YELLOW}Fetching latest version...${NC}"
|
||||
LATEST_VERSION=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
|
||||
|
||||
if [ -z "$LATEST_VERSION" ]; then
|
||||
echo -e "${RED}Failed to fetch latest version${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}Latest version: ${LATEST_VERSION}${NC}"
|
||||
}
|
||||
|
||||
# Download and install binary
|
||||
install_binary() {
|
||||
local version="${1:-$LATEST_VERSION}"
|
||||
local download_url="https://github.com/${REPO}/releases/download/${version}/docker-credential-atcr_${version#v}_${OS}_${ARCH}.tar.gz"
|
||||
local version="${1:-$VERSION}"
|
||||
local download_url="${TANGLED_REPO}/tags/${TAG_HASH}/download/docker-credential-atcr_${version#v}_${OS}_${ARCH}.tar.gz"
|
||||
|
||||
echo -e "${YELLOW}Downloading from: ${download_url}${NC}"
|
||||
|
||||
@@ -135,10 +125,10 @@ main() {
|
||||
|
||||
# Allow specifying version via environment variable
|
||||
if [ -z "$ATCR_VERSION" ]; then
|
||||
get_latest_version
|
||||
echo -e "Using version: ${GREEN}${VERSION}${NC}"
|
||||
else
|
||||
LATEST_VERSION="$ATCR_VERSION"
|
||||
echo -e "Using specified version: ${GREEN}${LATEST_VERSION}${NC}"
|
||||
VERSION="$ATCR_VERSION"
|
||||
echo -e "Using specified version: ${GREEN}${VERSION}${NC}"
|
||||
fi
|
||||
|
||||
install_binary
|
||||
|
||||
@@ -15,4 +15,6 @@ ARTIFACT_JSON=$(echo "$BLOB_OUTPUT" | jq --arg tag "$TAG_BYTES" --arg name "$ART
|
||||
}') &&
|
||||
echo "$ARTIFACT_JSON" > temp_artifact.json &&
|
||||
cat temp_artifact.json &&
|
||||
goat record create temp_artifact.json -n
|
||||
goat record create temp_artifact.json -n
|
||||
rm temp_artifact.json
|
||||
sleep 2
|
||||
Reference in New Issue
Block a user