Initial commit: Email Assistant project
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Create repo on gitea and push email-assistant
|
||||
set -e
|
||||
|
||||
REPO="email-assistant"
|
||||
GITEA_URL="https://gitea.nixg.ru"
|
||||
USERNAME="hermes"
|
||||
PASSWORD="twJohTWObFn1vO15"
|
||||
|
||||
echo "=== Creating repo ${REPO} on ${GITEA_URL} ==="
|
||||
RESP=$(curl -s -w "\n%{http_code}" -X POST "${GITEA_URL}/api/v1/user/repos" \
|
||||
-u "${USERNAME}:${PASSWORD}" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"name\":\"${REPO}\",\"description\":\"Email Assistant — локальный архив и ассистент почты\",\"private\":false,\"auto_init\":false}")
|
||||
|
||||
HTTP_CODE=$(echo "$RESP" | tail -1)
|
||||
BODY=$(echo "$RESP" | head -n -1)
|
||||
echo "HTTP: ${HTTP_CODE}"
|
||||
echo "Response: ${BODY:0:500}"
|
||||
|
||||
if [ "$HTTP_CODE" -eq 201 ]; then
|
||||
echo "=== Repo created ==="
|
||||
elif echo "$BODY" | grep -q "already exists"; then
|
||||
echo "=== Repo already exists ==="
|
||||
else
|
||||
echo "=== FAILED ==="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== Pushing to ${GITEA_URL}/${USERNAME}/${REPO}.git ==="
|
||||
cd /opt/hermes/email-assistant
|
||||
git remote remove origin 2>/dev/null || true
|
||||
git remote add origin "${GITEA_URL}/${USERNAME}/${REPO}.git"
|
||||
git add -A
|
||||
git commit -m "Initial commit: Email Assistant project" 2>/dev/null || echo "Nothing to commit"
|
||||
git push -u origin master 2>&1 || git push -u origin main 2>&1
|
||||
echo "=== DONE ==="
|
||||
Reference in New Issue
Block a user