front/upload-to-github.ps1

75 lines
2.6 KiB
PowerShell

# GitHub Auto Upload Script
# Requires Git to be installed and GitHub authentication configured
Write-Host "Starting GitHub upload..." -ForegroundColor Green
# Check if Git is available
try {
$gitVersion = git --version 2>$null
if ($gitVersion) {
Write-Host "Git version: $gitVersion" -ForegroundColor Green
} else {
throw "Git not found"
}
} catch {
Write-Host "Error: Git not installed or not in PATH" -ForegroundColor Red
Write-Host "Please visit https://git-scm.com/downloads to download Git" -ForegroundColor Yellow
Write-Host "Make sure to check 'Add Git to PATH' during installation" -ForegroundColor Yellow
exit 1
}
# Check if we're in a Git repository
if (-not (Test-Path ".git")) {
Write-Host "Initializing Git repository..." -ForegroundColor Yellow
git init
}
# Check remote repository configuration
$remoteUrl = git remote get-url origin 2>$null
if (-not $remoteUrl) {
Write-Host "Adding remote repository..." -ForegroundColor Yellow
git remote add origin https://github.com/xiaoliutral/itfx-front.git
} else {
Write-Host "Remote repository configured: $remoteUrl" -ForegroundColor Green
}
# Add all files
Write-Host "Adding files to staging area..." -ForegroundColor Yellow
git add .
# Check if there are changes
$status = git status --porcelain
if (-not $status) {
Write-Host "No new changes to commit" -ForegroundColor Yellow
exit 0
}
# Commit changes
Write-Host "Committing changes..." -ForegroundColor Yellow
git commit -m "Update: Vue.js interface management system with Handsontable integration
- Added Handsontable for advanced table functionality
- Implemented search and filter features
- Created multiple management pages (orders, channels, trajectory)
- Optimized table header styling
- Added comprehensive README documentation"
# Push to GitHub
Write-Host "Pushing to GitHub..." -ForegroundColor Yellow
try {
git push -u origin main
Write-Host "Code successfully uploaded to GitHub!" -ForegroundColor Green
Write-Host "Repository: https://github.com/xiaoliutral/itfx-front" -ForegroundColor Cyan
} catch {
Write-Host "Push failed, trying master branch..." -ForegroundColor Yellow
try {
git push -u origin master
Write-Host "Code successfully uploaded to GitHub!" -ForegroundColor Green
Write-Host "Repository: https://github.com/xiaoliutral/itfx-front" -ForegroundColor Cyan
} catch {
Write-Host "Push failed, please check network connection and GitHub authentication" -ForegroundColor Red
Write-Host "Consider using GitHub Desktop for upload" -ForegroundColor Yellow
}
}
Write-Host "Script execution completed" -ForegroundColor Green