Skip to content

Commit 7d0bb6b

Browse files
committed
update build proyect
1 parent 90f9042 commit 7d0bb6b

File tree

2 files changed

+48
-5
lines changed

2 files changed

+48
-5
lines changed

.github/workflows/CirupieD2.png

429 KB
Loading

.github/workflows/main.yml

+48-5
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,63 @@ jobs:
4949
run: snyk test --all-projects --severity-threshold=high
5050

5151
deploy:
52-
needs: integration-tests
5352
runs-on: ubuntu-latest
53+
needs: build-and-test
54+
if: github.ref == 'refs/heads/master'
5455
steps:
5556
- name: Checkout code
5657
uses: actions/checkout@v3
5758

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
6261

6362
- name: Install dependencies
6463
run: npm install
6564

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+
66109
notify-email:
67110
needs: [lint, integration-tests, deploy]
68111
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)