works on #34 Reviewed-on: #35 Co-authored-by: Josh <josh@joshuaschuett.com> Co-committed-by: Josh <josh@joshuaschuett.com>
33 lines
923 B
Bash
Executable File
33 lines
923 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Load config if present else use environment.
|
|
CONFIG_FILE="$(dirname "$0")/local.env"
|
|
if [ -f "$CONFIG_FILE" ]; then
|
|
source "$CONFIG_FILE"
|
|
fi
|
|
|
|
|
|
# Latest package.
|
|
OUTFILE=$(ls -1t ./deploy/package/* | head -n1 || true)
|
|
|
|
FILENAME="$(basename "$OUTFILE")"
|
|
VERSION="${FILENAME%%.*}"
|
|
|
|
|
|
echo "[*] Pushing ${VERSION} to registry."
|
|
curl -f -u "${REGISTRY_USER}:${REGISTRY_TOKEN}" \
|
|
--upload-file "$OUTFILE" \
|
|
"${REGISTRY_URL}/api/packages/projects/generic/chess/${VERSION}/chess.zip"
|
|
|
|
|
|
echo "[*] Deleting ${VERSION} latest to overwrite."
|
|
curl -f -u "${REGISTRY_USER}:${REGISTRY_TOKEN}" \
|
|
-X DELETE \
|
|
"${REGISTRY_URL}/api/packages/projects/generic/chess/latest/chess.zip" || true
|
|
|
|
|
|
echo "[*] Pushing ${VERSION} as latest to registry."
|
|
curl -f -u "${REGISTRY_USER}:${REGISTRY_TOKEN}" \
|
|
--upload-file "$OUTFILE" \
|
|
"${REGISTRY_URL}/api/packages/projects/generic/chess/latest/chess.zip" || true
|