SilverDROID - Dark Side Admin with CI/CD pipeline
- Android PWA/WASM launcher with glassmorphism UI - Loads https://admin.dark.side directly on launch - Complete GitLab CI/CD pipeline configuration - Automated builds for Debug, Release, and AAB - Full WASM support with optimized WebView - Material Design 3 theme - Comprehensive documentation Features: - Auto-load target URL on app launch - Glassmorphism components (frosted glass effects) - Full PWA/WASM support - Room database for future extensions - Jetpack Compose UI - CI/CD with artifact storage Built for SilverLABS
This commit is contained in:
161
push-to-gitlab.ps1
Normal file
161
push-to-gitlab.ps1
Normal file
@@ -0,0 +1,161 @@
|
||||
# SilverDROID - Push to GitLab Script (PowerShell)
|
||||
# Automates the process of pushing the project to GitLab CE
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$GITLAB_URL = "https://gitlab.silverlabs.uk"
|
||||
$GITLAB_TOKEN = "glpat-wqUcD7mg53F1mgM-N-PdiW86MQp1OjEH.01.0w074ox93"
|
||||
$PROJECT_NAME = "silverdroid"
|
||||
$NAMESPACE = "SilverLABS"
|
||||
$PROJECT_PATH = "$NAMESPACE/$PROJECT_NAME"
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "================================================" -ForegroundColor Cyan
|
||||
Write-Host " SilverDROID - GitLab Push Script" -ForegroundColor Cyan
|
||||
Write-Host "================================================" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Check if git is initialized
|
||||
if (-not (Test-Path .git)) {
|
||||
Write-Host "📦 Initializing Git repository..." -ForegroundColor Yellow
|
||||
git init
|
||||
Write-Host "✅ Git initialized" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "✅ Git repository already initialized" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Check if GitLab remote exists
|
||||
$remotes = git remote
|
||||
if ($remotes -contains "origin") {
|
||||
Write-Host "✅ Remote 'origin' already configured" -ForegroundColor Green
|
||||
$currentUrl = git remote get-url origin
|
||||
Write-Host " Current URL: $currentUrl" -ForegroundColor Gray
|
||||
|
||||
$updateRemote = Read-Host "Do you want to update the remote URL? (y/N)"
|
||||
if ($updateRemote -eq "y" -or $updateRemote -eq "Y") {
|
||||
git remote set-url origin "https://gitlab.silverlabs.uk/$PROJECT_PATH.git"
|
||||
Write-Host "✅ Remote URL updated" -ForegroundColor Green
|
||||
}
|
||||
} else {
|
||||
Write-Host "🔗 Adding GitLab remote..." -ForegroundColor Yellow
|
||||
git remote add origin "https://gitlab.silverlabs.uk/$PROJECT_PATH.git"
|
||||
Write-Host "✅ Remote added" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Check for uncommitted changes
|
||||
$status = git status -s
|
||||
if ($status) {
|
||||
Write-Host ""
|
||||
Write-Host "📝 Uncommitted changes detected:" -ForegroundColor Yellow
|
||||
git status -s
|
||||
Write-Host ""
|
||||
$commitChanges = Read-Host "Do you want to commit these changes? (Y/n)"
|
||||
|
||||
if ($commitChanges -ne "n" -and $commitChanges -ne "N") {
|
||||
$commitMsg = Read-Host "Enter commit message (or press Enter for default)"
|
||||
if ([string]::IsNullOrWhiteSpace($commitMsg)) {
|
||||
$commitMsg = "SilverDROID - Dark Side Admin build configuration"
|
||||
}
|
||||
|
||||
Write-Host "📦 Adding files..." -ForegroundColor Yellow
|
||||
git add .
|
||||
|
||||
Write-Host "💾 Creating commit..." -ForegroundColor Yellow
|
||||
git commit -m $commitMsg
|
||||
Write-Host "✅ Changes committed" -ForegroundColor Green
|
||||
}
|
||||
} else {
|
||||
Write-Host "✅ No uncommitted changes" -ForegroundColor Green
|
||||
}
|
||||
|
||||
# Check current branch
|
||||
$currentBranch = git branch --show-current
|
||||
if ([string]::IsNullOrWhiteSpace($currentBranch)) {
|
||||
Write-Host "🌿 Creating main branch..." -ForegroundColor Yellow
|
||||
git checkout -b main
|
||||
$currentBranch = "main"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "Current branch: $currentBranch" -ForegroundColor Cyan
|
||||
Write-Host ""
|
||||
|
||||
# Push to GitLab
|
||||
$pushConfirm = Read-Host "Ready to push to GitLab? (Y/n)"
|
||||
if ($pushConfirm -ne "n" -and $pushConfirm -ne "N") {
|
||||
Write-Host ""
|
||||
Write-Host "🚀 Pushing to GitLab..." -ForegroundColor Yellow
|
||||
|
||||
try {
|
||||
git push -u origin $currentBranch
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "================================================" -ForegroundColor Green
|
||||
Write-Host " ✅ Successfully pushed to GitLab!" -ForegroundColor Green
|
||||
Write-Host "================================================" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "📍 Project URL:" -ForegroundColor Cyan
|
||||
Write-Host " $GITLAB_URL/$PROJECT_PATH" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "🔧 Pipeline URL:" -ForegroundColor Cyan
|
||||
Write-Host " $GITLAB_URL/$PROJECT_PATH/-/pipelines" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "📦 CI/CD Jobs:" -ForegroundColor Cyan
|
||||
Write-Host " $GITLAB_URL/$PROJECT_PATH/-/jobs" -ForegroundColor White
|
||||
Write-Host ""
|
||||
Write-Host "Next steps:" -ForegroundColor Yellow
|
||||
Write-Host " 1. Visit the project URL above"
|
||||
Write-Host " 2. Check the pipeline status"
|
||||
Write-Host " 3. Wait for build to complete (~5-8 minutes)"
|
||||
Write-Host " 4. Download APK from artifacts"
|
||||
Write-Host ""
|
||||
|
||||
} catch {
|
||||
Write-Host "❌ Push failed: $_" -ForegroundColor Red
|
||||
Write-Host ""
|
||||
Write-Host "Try authenticating with:" -ForegroundColor Yellow
|
||||
Write-Host " git config --global credential.helper wincred"
|
||||
Write-Host " git push -u origin $currentBranch"
|
||||
exit 1
|
||||
}
|
||||
} else {
|
||||
Write-Host "❌ Push cancelled" -ForegroundColor Red
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Optional: Create project description
|
||||
$updateDesc = Read-Host "Update project description on GitLab? (y/N)"
|
||||
if ($updateDesc -eq "y" -or $updateDesc -eq "Y") {
|
||||
Write-Host "📝 Updating project description..." -ForegroundColor Yellow
|
||||
|
||||
try {
|
||||
$headers = @{
|
||||
"PRIVATE-TOKEN" = $GITLAB_TOKEN
|
||||
"Content-Type" = "application/json"
|
||||
}
|
||||
|
||||
$searchUrl = "$GITLAB_URL/api/v4/projects?search=$PROJECT_NAME"
|
||||
$projects = Invoke-RestMethod -Uri $searchUrl -Headers $headers -Method Get
|
||||
|
||||
if ($projects.Count -gt 0) {
|
||||
$projectId = $projects[0].id
|
||||
$updateUrl = "$GITLAB_URL/api/v4/projects/$projectId"
|
||||
|
||||
$body = @{
|
||||
description = "SilverDROID - Android PWA/WASM Launcher for Dark Side Admin. Glassmorphism UI with direct loading of admin.dark.side"
|
||||
topics = @("android", "pwa", "wasm", "glassmorphism", "launcher")
|
||||
} | ConvertTo-Json
|
||||
|
||||
Invoke-RestMethod -Uri $updateUrl -Headers $headers -Method Put -Body $body | Out-Null
|
||||
Write-Host "✅ Project description updated" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "⚠️ Could not find project" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
Write-Host "⚠️ Could not update description: $_" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "🎉 All done! Your pipeline should start automatically." -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Reference in New Issue
Block a user