Files
at-container-registry/scripts/publish-artifact.sh
2025-10-12 23:35:33 -05:00

20 lines
723 B
Bash
Executable File

#!/usr/bin/env bash
set -e
goat account login -u evan.jarrett.net -p "${APP_PASSWORD}"
TAG_HASH=$(git rev-parse "$TAG") &&
TAG_BYTES=$(echo -n "$TAG_HASH" | xxd -r -p | base64 | tr -d '=') &&
BLOB_OUTPUT=$(goat blob upload "$ARTIFACT_PATH") &&
echo "$BLOB_OUTPUT" &&
ARTIFACT_JSON=$(echo "$BLOB_OUTPUT" | jq --arg tag "$TAG_BYTES" --arg name "$ARTIFACT_NAME" --arg repo "$REPO_URL" --arg created "$(date -Iseconds)" '{
"tag": {"$bytes": $tag},
"name": $name,
"repo": $repo,
"$type": "sh.tangled.repo.artifact",
"artifact": .,
"createdAt": $created
}') &&
echo "$ARTIFACT_JSON" > temp_artifact.json &&
cat temp_artifact.json &&
goat record create temp_artifact.json -n
rm temp_artifact.json
sleep 2