ci: no fallar la compilacion cuando falta el secreto de Google Play [version set]
El paso que prepara las credenciales hacia `exit 1` si no encontraba GOOGLE_PLAY_SERVICE_ACCOUNT_JSON, y ese secreto no se ha configurado nunca: TODA compilacion de PRO terminaba en rojo por una automatizacion que jamas llego a activarse, mientras los AAB se subian a Play a mano. Un rojo permanente entrena a ignorar los rojos, y entonces el dia que falle algo de verdad tampoco se mira. Ahora el paso se omite con un aviso y expone `disponible`, del que dependen los dos pasos siguientes. No se pierde nada: el AAB ya esta compilado, firmado y subido a ftl-builds antes de llegar aqui. El dia que se configure el secreto, los tres pasos se reactivan solos sin tocar el workflow. El aviso de Telegram deja de afirmar "Publicado en Google Play" cuando la subida se ha omitido. Un mensaje que dice que se publico algo que no se publico es peor que no mandar mensaje.
This commit is contained in:
@@ -268,25 +268,40 @@ jobs:
|
|||||||
echo "✅ APK: builds.freetimelab.es → pluriwave → v${VERSION} → ${APK_NOMBRE}"
|
echo "✅ APK: builds.freetimelab.es → pluriwave → v${VERSION} → ${APK_NOMBRE}"
|
||||||
echo "✅ AAB: builds.freetimelab.es → pluriwave → v${VERSION} → ${AAB_NOMBRE}"
|
echo "✅ AAB: builds.freetimelab.es → pluriwave → v${VERSION} → ${AAB_NOMBRE}"
|
||||||
|
|
||||||
|
# La publicacion automatica en Google Play es OPCIONAL.
|
||||||
|
#
|
||||||
|
# Este paso hacia `exit 1` cuando faltaba el secreto, asi que TODA
|
||||||
|
# compilacion de PRO terminaba en rojo por una funcion que nunca llego a
|
||||||
|
# activarse: el secreto no se configuro nunca y las subidas a Play se han
|
||||||
|
# hecho siempre a mano. Un rojo permanente entrena a ignorar los rojos, y
|
||||||
|
# entonces el dia que falle algo de verdad tampoco se mira.
|
||||||
|
#
|
||||||
|
# Ahora se omite con un aviso. El AAB ya esta compilado, firmado y subido
|
||||||
|
# a ftl-builds por el paso anterior, asi que no se pierde nada. El dia que
|
||||||
|
# se configure el secreto, los tres pasos se activan solos.
|
||||||
- name: Preparar credenciales de Google Play
|
- name: Preparar credenciales de Google Play
|
||||||
|
id: credenciales_play
|
||||||
if: ${{ gitea.ref == 'refs/heads/PRO' }}
|
if: ${{ gitea.ref == 'refs/heads/PRO' }}
|
||||||
env:
|
env:
|
||||||
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
|
GOOGLE_PLAY_SERVICE_ACCOUNT_JSON: ${{ secrets.GOOGLE_PLAY_SERVICE_ACCOUNT_JSON }}
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" ]; then
|
if [ -z "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" ]; then
|
||||||
echo "ERROR: falta el secreto GOOGLE_PLAY_SERVICE_ACCOUNT_JSON"
|
echo "disponible=no" >> "$GITHUB_OUTPUT"
|
||||||
exit 1
|
echo "AVISO: falta el secreto GOOGLE_PLAY_SERVICE_ACCOUNT_JSON."
|
||||||
|
echo "Se omite la publicacion en Google Play; sube el AAB a mano."
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
mkdir -p fastlane/credentials
|
mkdir -p fastlane/credentials
|
||||||
printf '%s' "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" > fastlane/credentials/google-play-service-account.json
|
printf '%s' "$GOOGLE_PLAY_SERVICE_ACCOUNT_JSON" > fastlane/credentials/google-play-service-account.json
|
||||||
|
echo "disponible=si" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Instalar Fastlane
|
- name: Instalar Fastlane
|
||||||
if: ${{ gitea.ref == 'refs/heads/PRO' }}
|
if: ${{ gitea.ref == 'refs/heads/PRO' && steps.credenciales_play.outputs.disponible == 'si' }}
|
||||||
run: |
|
run: |
|
||||||
gem list -i fastlane >/dev/null 2>&1 || gem install fastlane --no-document
|
gem list -i fastlane >/dev/null 2>&1 || gem install fastlane --no-document
|
||||||
|
|
||||||
- name: Publicar AAB en Google Play Internal Testing
|
- name: Publicar AAB en Google Play Internal Testing
|
||||||
if: ${{ gitea.ref == 'refs/heads/PRO' }}
|
if: ${{ gitea.ref == 'refs/heads/PRO' && steps.credenciales_play.outputs.disponible == 'si' }}
|
||||||
env:
|
env:
|
||||||
PLAY_JSON_KEY_PATH: fastlane/credentials/google-play-service-account.json
|
PLAY_JSON_KEY_PATH: fastlane/credentials/google-play-service-account.json
|
||||||
PLAY_AAB_PATH: build/app/outputs/bundle/release/app-release.aab
|
PLAY_AAB_PATH: build/app/outputs/bundle/release/app-release.aab
|
||||||
@@ -304,8 +319,13 @@ jobs:
|
|||||||
if [ -z "$BOT_TOKEN" ]; then exit 0; fi
|
if [ -z "$BOT_TOKEN" ]; then exit 0; fi
|
||||||
if [ "${{ job.status }}" = "success" ]; then
|
if [ "${{ job.status }}" = "success" ]; then
|
||||||
MSG="✅ *PluriWave* v${VERSION} · rama ${BRANCH} · ${COMMIT}%0AAPK + AAB generados"
|
MSG="✅ *PluriWave* v${VERSION} · rama ${BRANCH} · ${COMMIT}%0AAPK + AAB generados"
|
||||||
if [ "$BRANCH" = "PRO" ]; then
|
# Solo se anuncia la subida a Play cuando de verdad ocurrio: el paso
|
||||||
|
# se omite si falta el secreto, y un aviso que dice "publicado"
|
||||||
|
# cuando no se publico es peor que no avisar.
|
||||||
|
if [ "$BRANCH" = "PRO" ] && [ "${{ steps.credenciales_play.outputs.disponible }}" = "si" ]; then
|
||||||
MSG="${MSG}%0APublicado en Google Play · Internal Testing"
|
MSG="${MSG}%0APublicado en Google Play · Internal Testing"
|
||||||
|
elif [ "$BRANCH" = "PRO" ]; then
|
||||||
|
MSG="${MSG}%0AEn builds.freetimelab.es · sube el AAB a Play a mano"
|
||||||
else
|
else
|
||||||
MSG="${MSG}%0APublicado en builds.freetimelab.es"
|
MSG="${MSG}%0APublicado en builds.freetimelab.es"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user