-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush.sh
executable file
·59 lines (50 loc) · 1.43 KB
/
push.sh
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
#!/bin/bash
# Script para generar y enviar archivos de prototipo a un repositorio remoto
# Parámetros:
# $1: Nombre del servicio
# $2: Versión de lanzamiento
# $3: Nombre de usuario
# Verificar argumentos
if [ $# -ne 3 ]; then
echo "Usage: $0 <service_name> <release_version> <username>"
exit 1
fi
SERVICE_NAME=$1
RELEASE_VERSION=$2
USERNAME=$3
init_module() {
cd "golang/$SERVICE_NAME" || exit 1
if ! go mod init "github.com/$USERNAME/cocosette-proto/golang/$SERVICE_NAME"; then
echo "Error: Failed to initialize Go module."
exit 1
fi
if ! go mod tidy; then
echo "Error: Failed to tidy Go modules."
exit 1
fi
cd ../.. || exit 1
}
# Agregar y confirmar archivos de prototipo
add_and_commit_proto_files() {
git add "proto/$SERVICE_NAME"
git commit -m "Add proto files for $SERVICE_NAME"
}
# Agregar y confirmar archivos generados automáticamente
add_and_commit_generated_files() {
git add "golang/$SERVICE_NAME"
git commit -m "Add autogenerated files for $SERVICE_NAME"
git add "third_party/OpenAPI"
git commit -m "Add third party files for Swagger"
}
# Subir cambios al repositorio remoto
push_to_remote() {
git push origin main -u
git tag -a "golang/$SERVICE_NAME/$RELEASE_VERSION" -m "golang/$SERVICE_NAME/$RELEASE_VERSION"
git push --tags
}
# Ejecutar funciones
init_module
add_and_commit_proto_files
add_and_commit_generated_files
push_to_remote
echo "Push successful."