Files
proxmox/token-lists/scripts/push-now.sh

92 lines
2.9 KiB
Bash
Executable File

#!/usr/bin/env bash
# Immediate push script - attempts to push with current remote configuration
# This is the recommended path for pushing token lists
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
log_success() { echo -e "${GREEN}[✓]${NC} $1"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
log_error() { echo -e "${RED}[ERROR]${NC} $1"; }
cd "$REPO_ROOT"
# Check remote
if ! git remote get-url origin &>/dev/null; then
log_error "No remote configured"
log_info "Setting up default remote: git@github.com:defiQUG/proxmox.git"
git remote add origin git@github.com:defiQUG/proxmox.git
fi
REPO_URL=$(git remote get-url origin)
log_info "Remote: $REPO_URL"
# Get current branch
CURRENT_BRANCH=$(git branch --show-current)
log_info "Branch: $CURRENT_BRANCH"
# Test repository access
log_info "Testing repository access..."
if git ls-remote --heads origin &>/dev/null 2>&1; then
log_success "Repository is accessible!"
# Push commits
log_info "Pushing commits..."
if git push -u origin "$CURRENT_BRANCH" 2>&1; then
log_success "✅ Commits pushed successfully!"
else
log_error "Failed to push commits"
exit 1
fi
# Push tags
log_info "Pushing tags..."
if git push origin --tags 2>&1; then
log_success "✅ Tags pushed successfully!"
else
log_error "Failed to push tags"
exit 1
fi
# Success summary
echo ""
log_success "🎉 Push complete!"
echo ""
log_info "Token lists are now available at:"
if [[ "$REPO_URL" =~ git@github.com:([^/]+)/(.+)\.git ]]; then
USER_ORG="${BASH_REMATCH[1]}"
REPO_NAME="${BASH_REMATCH[2]}"
BASE_URL="https://raw.githubusercontent.com/$USER_ORG/$REPO_NAME"
echo " - ChainID 138: $BASE_URL/$CURRENT_BRANCH/token-lists/lists/dbis-138.tokenlist.json"
echo " - Ethereum Mainnet: $BASE_URL/$CURRENT_BRANCH/token-lists/lists/ethereum-mainnet.tokenlist.json"
echo " - ALL Mainnet: $BASE_URL/$CURRENT_BRANCH/token-lists/lists/all-mainnet.tokenlist.json"
fi
else
log_error "Repository not accessible at: $REPO_URL"
echo ""
log_info "The repository may not exist yet. To create it:"
echo " 1. Go to: https://github.com/new"
echo " 2. Repository name: proxmox"
echo " 3. Owner: defiQUG (or your organization)"
echo " 4. Do NOT initialize with README, .gitignore, or license"
echo " 5. Click 'Create repository'"
echo ""
log_info "Then run this script again:"
echo " ./token-lists/scripts/push-now.sh"
echo ""
log_info "Or update the remote URL if using a different repository:"
echo " git remote set-url origin git@github.com:YOUR_USERNAME/YOUR_REPO.git"
exit 1
fi