-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_github.sh
More file actions
executable file
·110 lines (89 loc) · 2.89 KB
/
Copy pathsetup_github.sh
File metadata and controls
executable file
·110 lines (89 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/env bash
set -Eeuo pipefail
ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
cd "$ROOT"
OWNER="${GITHUB_OWNER:-technifree}"
REPO="${REPO_NAME:-LibraMail}"
VISIBILITY="${VISIBILITY:-public}"
DEFAULT_BRANCH="${DEFAULT_BRANCH:-master}"
DESCRIPTION="${REPO_DESCRIPTION:-LibraMail — lightweight local-first multi-account email client}"
HOMEPAGE="${REPO_HOMEPAGE:-https://technifree.com}"
case "$VISIBILITY" in public|private|internal) ;; *)
echo "VISIBILITY doit valoir public, private ou internal." >&2
exit 2
esac
for cmd in git gh python3; do
command -v "$cmd" >/dev/null 2>&1 || {
echo "Commande requise absente : $cmd" >&2
exit 1
}
done
gh auth status >/dev/null 2>&1 || {
echo "GitHub CLI n'est pas connecté. Lancez : gh auth login" >&2
exit 1
}
[[ -f neutralino.config.json && -d resources && -d engine ]] || {
echo "Ce script doit être placé à la racine de LibraMail." >&2
exit 1
}
if [[ ! -d .git ]]; then
git init
fi
git checkout -B "$DEFAULT_BRANCH"
# Adapte les liens du README lorsque le propriétaire ou le dépôt est personnalisé.
python3 - "$OWNER" "$REPO" <<'PY'
from pathlib import Path
import re
import sys
path = Path("README.md")
text = path.read_text(encoding="utf-8")
text = re.sub(r"github\.com/[^/\s)]+/LibraMail", f"github.com/{sys.argv[1]}/{sys.argv[2]}", text)
path.write_text(text, encoding="utf-8")
PY
chmod +x github.sh setup_github.sh release.sh build_github.sh \
security_check.sh update_readme.sh build_linux.sh tools/*.py
./security_check.sh
python3 tools/check_version.py
mkdir -p data
touch data/.gitkeep
git add .
./security_check.sh
if git diff --cached --quiet; then
echo "[Git] Aucun nouveau fichier à valider."
else
git commit -m "Initial publication of LibraMail $(cat VERSION)"
fi
FULL_REPO="$OWNER/$REPO"
if gh repo view "$FULL_REPO" >/dev/null 2>&1; then
echo "[GitHub] Le dépôt $FULL_REPO existe déjà."
if git remote get-url origin >/dev/null 2>&1; then
git remote set-url origin "https://github.com/$FULL_REPO.git"
else
git remote add origin "https://github.com/$FULL_REPO.git"
fi
else
echo "[GitHub] Création du dépôt $FULL_REPO ($VISIBILITY)..."
gh repo create "$FULL_REPO" "--$VISIBILITY" \
--source=. --remote=origin \
--description "$DESCRIPTION"
fi
git push -u origin "$DEFAULT_BRANCH"
gh repo edit "$FULL_REPO" \
--description "$DESCRIPTION" \
--homepage "$HOMEPAGE" \
--enable-issues \
--enable-wiki=false \
--default-branch "$DEFAULT_BRANCH" || true
gh repo edit "$FULL_REPO" \
--add-topic email \
--add-topic imap \
--add-topic smtp \
--add-topic neutralinojs \
--add-topic sqlite \
--add-topic javascript \
--add-topic linux \
--add-topic windows \
--add-topic privacy || true
printf '\nDépôt prêt : https://github.com/%s\n' "$FULL_REPO"
printf 'Compilation GitHub : ./github.sh build\n'
printf 'Publication : ./github.sh release %s\n' "$(cat VERSION)"