Dave Jarvis' Repositories

git clone https://repo.autonoma.ca/repo/keenwrite.git

Adds publish script to upload binaries

Author DaveJarvis <email>
Date 2023-10-02 11:32:53 GMT-0700
Commit 5d38dfb7c9fc63754eccb13cf11abb7318915049
Parent 2701949
Delta 39 lines added, 1 line removed, 38-line increase
.gitignore
keenwrite.build_artifacts.txt
todo
+tokens
installer.sh
# ---------------------------------------------------------------------------
-# Generates
+# Generates an application binary as a self-extracting installer.
# ---------------------------------------------------------------------------
execute() {
publish.sh
+#!/usr/bin/env bash
+
+# ---------------------------------------------------------------------------
+# This script uploads the latest application release for all supported
+# platforms.
+# ---------------------------------------------------------------------------
+
+readonly RELEASE=$(git describe --abbrev=0 --tags)
+readonly APP_NAME=$(cut -d= -f2 ./src/main/resources/bootstrap.properties)
+readonly PATH_TOKEN="tokens/${APP_NAME,,}.pat"
+
+# ---------------------------------------------------------------------------
+# Publishes a self-extracting installer to the repository.
+#
+# $1 - The relative path to the file to upload.
+# ---------------------------------------------------------------------------
+publish() {
+ local -r PATH_ARCHIVE="build/libs/${1}"
+
+ if [ -f "${PATH_ARCHIVE}" ]; then
+ glab release upload ${RELEASE} "${PATH_ARCHIVE}"
+ else
+ echo "Missing ${PATH_ARCHIVE}, continuing."
+ fi
+}
+
+if [ -f "${PATH_TOKEN}" ]; then
+ cat "${PATH_TOKEN}" | glab auth login --hostname gitlab.com --stdin
+
+ publish "${APP_NAME,,}.jar"
+ publish "${APP_NAME,,}.bin"
+ publish "${APP_NAME,,}.app"
+ publish "${APP_NAME}.exe"
+else
+ echo "Create ${PATH_TOKEN} before publishing the release."
+fi
+