-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease-github.sh
More file actions
executable file
·73 lines (61 loc) · 2.12 KB
/
release-github.sh
File metadata and controls
executable file
·73 lines (61 loc) · 2.12 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
#!/bin/bash
# Script per rilasciare il plugin su GitHub
set -e
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DIST_DIR="$REPO_DIR/dist"
PLUGIN_DIR="$REPO_DIR/affilify-tracking"
# Leggi la versione dal plugin
VERSION=$(grep "Version:" "$PLUGIN_DIR/affilify-tracking.php" | head -1 | sed 's/.*Version: \(.*\)$/\1/' | tr -d ' ')
if [ -z "$VERSION" ]; then
echo "❌ Errore: impossibile leggere la versione dal plugin"
exit 1
fi
ZIP_FILE="$DIST_DIR/affilify-tracking-${VERSION}.zip"
TAG="v${VERSION}"
# Verifica che il ZIP esista
if [ ! -f "$ZIP_FILE" ]; then
echo "❌ Errore: il file $ZIP_FILE non esiste"
echo "💡 Esegui prima: ./build-distribution.sh"
exit 1
fi
echo "📤 Preparazione per il rilascio su GitHub..."
echo "🔖 Tag: $TAG"
echo "📦 File: $ZIP_FILE"
echo ""
# Verifica che il repo sia pulito
if [ -n "$(git -C "$REPO_DIR" status --porcelain)" ]; then
echo "⚠️ Warning: Ci sono file non committati nel repository"
echo " Vuoi continuare comunque? (y/n)"
read -r response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
echo "❌ Rilascio annullato"
exit 1
fi
fi
# Crea il tag se non esiste
if git -C "$REPO_DIR" rev-parse "$TAG" >/dev/null 2>&1; then
echo "⚠️ Il tag $TAG esiste già"
echo " Vuoi sovrascriverlo? (y/n)"
read -r response
if [[ "$response" =~ ^[Yy]$ ]]; then
git -C "$REPO_DIR" tag -d "$TAG"
git -C "$REPO_DIR" push origin --delete "$TAG"
else
echo "❌ Rilascio annullato"
exit 1
fi
fi
# Crea il tag
git -C "$REPO_DIR" tag -a "$TAG" -m "Release version $VERSION"
git -C "$REPO_DIR" push origin "$TAG"
echo "✅ Tag $TAG creato e pushato su GitHub"
echo ""
echo "📝 Prossimo passo: crea la release su GitHub"
echo " 1. Vai su: https://github.com/blhack-it/affilify-wordpress/releases"
echo " 2. Clicca su 'Draft a new release'"
echo " 3. Seleziona il tag: $TAG"
echo " 4. Carica il file: $ZIP_FILE"
echo " 5. Aggiungi descrizione del rilascio"
echo " 6. Clicca 'Publish release'"
echo ""
echo "🔗 Link diretto: https://github.com/blhack-it/affilify-wordpress/releases/new?tag=$TAG"