@@ -49,20 +49,63 @@ jobs:
49
49
run : snyk test --all-projects --severity-threshold=high
50
50
51
51
deploy :
52
- needs : integration-tests
53
52
runs-on : ubuntu-latest
53
+ needs : build-and-test
54
+ if : github.ref == 'refs/heads/master'
54
55
steps :
55
56
- name : Checkout code
56
57
uses : actions/checkout@v3
57
58
58
- - name : Install Node.js
59
- uses : actions/setup-node@v2
60
- with :
61
- node-version : ' 20'
59
+ - name : Install EAS CLI
60
+ run : npm install -g eas-cli
62
61
63
62
- name : Install dependencies
64
63
run : npm install
65
64
65
+ - name : Build APK for Android
66
+ run : npx eas-cli build --platform android --profile preview --non-interactive
67
+ env :
68
+ EXPO_TOKEN : ${{ secrets.EXPO_TOKEN }}
69
+
70
+ - name : Upload image and send data to API
71
+ run : |
72
+ # Obtener URL del artefacto
73
+ RESPONSE=$(eas build:list --limit=1 --status=finished --json --non-interactive)
74
+ DOWNLOAD_URL=$(echo "$RESPONSE" | jq -r '.[0].artifacts.buildUrl')
75
+
76
+ echo "La URL del artefacto obtenida es: $DOWNLOAD_URL"
77
+
78
+ # Verificar si la imagen existe
79
+ if [ ! -f "$IMAGE_PATH" ]; then
80
+ echo "La imagen no existe en la ruta especificada: $IMAGE_PATH"
81
+ exit 1
82
+ fi
83
+
84
+ # Obtener solo el nombre del archivo desde la ruta completa
85
+ IMAGE_NAME=$(basename "$IMAGE_PATH")
86
+ echo "El nombre del icono es: $IMAGE_NAME"
87
+
88
+ # Subir la imagen al servidor PHP
89
+ curl -X POST \
90
+ -F "imagen=@$IMAGE_PATH" \
91
+ "$WEB_SERVICE_URL"
92
+
93
+ # Enviar datos a la API de Express
94
+ curl -X POST "$API_URL" \
95
+ -H "Content-Type: application/json" \
96
+ -d '{
97
+ "url": "'"$DOWNLOAD_URL"'",
98
+ "nombre": "'"$PROJECT_NAME"'",
99
+ "icono": "'"$IMAGE_NAME"'"
100
+ }'
101
+
102
+ env :
103
+ EXPO_TOKEN : ${{ secrets.EXPO_TOKEN }}
104
+ IMAGE_PATH : " .github/workflows/CirupieD2.png"
105
+ WEB_SERVICE_URL : " https://labarbada.store/subirImagen.php"
106
+ API_URL : " https://api-admin-six.vercel.app/api/guardar-datos"
107
+ PROJECT_NAME : " CirupieD"
108
+
66
109
notify-email :
67
110
needs : [lint, integration-tests, deploy]
68
111
runs-on : ubuntu-latest
0 commit comments