Enforce container name limit and update appstore push workflow

This commit is contained in:
Joachim Friberg
2026-03-19 22:16:12 +01:00
parent 6baad76e0d
commit 56dfa7a653
4 changed files with 54 additions and 6 deletions
+51 -4
View File
@@ -2,21 +2,49 @@
set -euo pipefail
repo_root="$(cd "$(dirname "$0")/.." && pwd)"
output_dir="${1:-$repo_root/dist}"
#zip_name="${2:-zima-appstore-$(date +%Y%m%d-%H%M%S).zip}"
zip_name="${2:-phirna-appstore.zip}"
push_mode=0
positional=()
while [[ $# -gt 0 ]]; do
case "$1" in
--push)
push_mode=1
shift
;;
-h|--help)
# handled below via usage
positional+=("$1")
shift
;;
*)
positional+=("$1")
shift
;;
esac
done
if [[ ${#positional[@]} -gt 2 ]]; then
echo "ERROR: too many arguments"
exit 2
fi
output_dir="${positional[0]:-$repo_root/dist}"
#zip_name="${positional[1]:-zima-appstore-$(date +%Y%m%d-%H%M%S).zip}"
zip_name="${positional[1]:-phirna-appstore.zip}"
usage() {
cat <<USAGE
Usage: $0 [output_dir] [zip_name]
$0 --push [output_dir] [zip_name]
Examples:
$0
$0 ./dist zima-apps-main.zip
$0 --push
USAGE
}
if [[ "${1:-}" == "-h" || "${1:-}" == "--help" ]]; then
if [[ "${positional[0]:-}" == "-h" || "${positional[0]:-}" == "--help" ]]; then
usage
exit 0
fi
@@ -111,3 +139,22 @@ if command -v shasum >/dev/null 2>&1; then
else
echo "ZIP created: $zip_path"
fi
if [[ "$push_mode" -eq 1 ]]; then
if [[ "$is_git_repo" -ne 1 ]]; then
echo "ERROR: --push requires a git repository"
exit 1
fi
echo "Push mode enabled: switching to main and publishing dist/"
git -C "$repo_root" checkout main
git -C "$repo_root" add dist/
if git -C "$repo_root" diff --cached --quiet; then
echo "No staged changes in dist/. Nothing to commit."
exit 0
fi
git -C "$repo_root" commit -m "Updated appstore"
git -C "$repo_root" push origin main
fi