Files
SilverDROID/push-to-gitlab.sh
SysAdmin c667765488 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
2025-09-30 17:13:14 +01:00

145 lines
4.3 KiB
Bash

#!/bin/bash
# SilverDROID - Push to GitLab Script
# Automates the process of pushing the project to GitLab CE
set -e
GITLAB_URL="https://gitlab.silverlabs.uk"
GITLAB_TOKEN="glpat-wqUcD7mg53F1mgM-N-PdiW86MQp1OjEH.01.0w074ox93"
PROJECT_NAME="silverdroid"
NAMESPACE="SilverLABS"
PROJECT_PATH="${NAMESPACE}/${PROJECT_NAME}"
echo "================================================"
echo " SilverDROID - GitLab Push Script"
echo "================================================"
echo ""
# Check if git is initialized
if [ ! -d .git ]; then
echo "📦 Initializing Git repository..."
git init
echo "✅ Git initialized"
else
echo "✅ Git repository already initialized"
fi
# Check if GitLab remote exists
if git remote | grep -q "origin"; then
echo "✅ Remote 'origin' already configured"
CURRENT_URL=$(git remote get-url origin)
echo " Current URL: $CURRENT_URL"
read -p "Do you want to update the remote URL? (y/N): " UPDATE_REMOTE
if [[ $UPDATE_REMOTE =~ ^[Yy]$ ]]; then
git remote set-url origin "https://gitlab.silverlabs.uk/${PROJECT_PATH}.git"
echo "✅ Remote URL updated"
fi
else
echo "🔗 Adding GitLab remote..."
git remote add origin "https://gitlab.silverlabs.uk/${PROJECT_PATH}.git"
echo "✅ Remote added"
fi
# Check for uncommitted changes
if [[ -n $(git status -s) ]]; then
echo ""
echo "📝 Uncommitted changes detected:"
git status -s
echo ""
read -p "Do you want to commit these changes? (Y/n): " COMMIT_CHANGES
if [[ ! $COMMIT_CHANGES =~ ^[Nn]$ ]]; then
read -p "Enter commit message (or press Enter for default): " COMMIT_MSG
if [ -z "$COMMIT_MSG" ]; then
COMMIT_MSG="SilverDROID - Dark Side Admin build configuration"
fi
echo "📦 Adding files..."
git add .
echo "💾 Creating commit..."
git commit -m "$COMMIT_MSG"
echo "✅ Changes committed"
fi
else
echo "✅ No uncommitted changes"
fi
# Check current branch
CURRENT_BRANCH=$(git branch --show-current)
if [ -z "$CURRENT_BRANCH" ]; then
echo "🌿 Creating main branch..."
git checkout -b main
CURRENT_BRANCH="main"
fi
echo ""
echo "Current branch: $CURRENT_BRANCH"
echo ""
# Push to GitLab
read -p "Ready to push to GitLab? (Y/n): " PUSH_CONFIRM
if [[ ! $PUSH_CONFIRM =~ ^[Nn]$ ]]; then
echo ""
echo "🚀 Pushing to GitLab..."
# Set up credential helper for this push
git config --local credential.helper store
# Push with token authentication
git push -u origin $CURRENT_BRANCH
echo ""
echo "================================================"
echo " ✅ Successfully pushed to GitLab!"
echo "================================================"
echo ""
echo "📍 Project URL:"
echo " ${GITLAB_URL}/${PROJECT_PATH}"
echo ""
echo "🔧 Pipeline URL:"
echo " ${GITLAB_URL}/${PROJECT_PATH}/-/pipelines"
echo ""
echo "📦 CI/CD Jobs:"
echo " ${GITLAB_URL}/${PROJECT_PATH}/-/jobs"
echo ""
echo "Next steps:"
echo " 1. Visit the project URL above"
echo " 2. Check the pipeline status"
echo " 3. Wait for build to complete (~5-8 minutes)"
echo " 4. Download APK from artifacts"
echo ""
else
echo "❌ Push cancelled"
exit 0
fi
# Optional: Create project description
read -p "Update project description on GitLab? (y/N): " UPDATE_DESC
if [[ $UPDATE_DESC =~ ^[Yy]$ ]]; then
echo "📝 Updating project description..."
PROJECT_ID=$(curl -s "${GITLAB_URL}/api/v4/projects?search=${PROJECT_NAME}" \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" | \
jq -r ".[0].id")
if [ "$PROJECT_ID" != "null" ]; then
curl -s -X PUT "${GITLAB_URL}/api/v4/projects/${PROJECT_ID}" \
--header "PRIVATE-TOKEN: ${GITLAB_TOKEN}" \
--header "Content-Type: application/json" \
--data '{
"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"]
}' > /dev/null
echo "✅ Project description updated"
else
echo "⚠️ Could not find project ID"
fi
fi
echo ""
echo "🎉 All done! Your pipeline should start automatically."
echo ""