Repository Public
1#!/bin/zsh2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : MacLustr SMS Gateway8# File : scripts/publish-apk.sh9# Module : scripts10# Repository : https://git.spboucher.ai/maclustr-sms11# Project Website : https://sms.spboucher.ai12# Created : 2026-11-3013# Last Modified : 2026-11-3014#15# Author : Simon-Pierre Boucher16# Position : Professor of Finance17# Institution : Université du Québec en Outaouais (UQO)18# Organization : SP Boucher19# Website : https://spboucher.ai20# Git : https://git.spboucher.ai21#22# Preferred Contact: admin@spboucher.ai23# Technical Contact: dev@spboucher.ai24# Security/Admin : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License : None specified (no license file in this repository)33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Publie l'APK signé sur le nœud de production (l'APK n'est pas dans git ; son manifeste releases/android-release.json l'est).42# usage (portable) : scripts/publish-apk.sh <nœud>43# Vérifie l'empreinte locale contre le manifeste, copie, puis revérifie l'empreinte sur le nœud.44set -euo pipefail45cd "$(dirname "$0")/.."46NODE="${1:?usage : $0 <nœud>}"47FILE=$(python3 -c 'import json;print(json.load(open("releases/android-release.json"))["file"])')48WANT=$(python3 -c 'import json;print(json.load(open("releases/android-release.json"))["sha256"])')49GOT=$(shasum -a 256 "releases/$FILE" | cut -d' ' -f1)50[ "$GOT" = "$WANT" ] || { echo "empreinte locale $GOT ≠ manifeste $WANT"; exit 1; }51ssh "$NODE" 'mkdir -p ~/maclustr-sms-data/releases'52scp -q "releases/$FILE" releases/android-release.json "$NODE:maclustr-sms-data/releases/"53REMOTE=$(ssh "$NODE" "shasum -a 256 ~/maclustr-sms-data/releases/$FILE | cut -d' ' -f1")54[ "$REMOTE" = "$WANT" ] || { echo "empreinte sur le nœud $REMOTE ≠ manifeste $WANT"; exit 1; }55echo "APK publié sur $NODE : $FILE ($WANT)"56