From dbf8b1940a88499f1156380b0c562e35bc309444 Mon Sep 17 00:00:00 2001
From: Stefan Hynek <stefan.hynek@uni-goettingen.de>
Date: Tue, 18 Aug 2020 08:45:16 +0200
Subject: [PATCH] feat(semantic-release): provide helper scripts for
 semantic-release

`prepare` builds the xar file depending on the branch; `publish` uploads to the exist repo
---
 prepare | 21 +++++++++++++++++++++
 publish | 20 ++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100755 prepare
 create mode 100755 publish

diff --git a/prepare b/prepare
new file mode 100755
index 0000000..9fd0039
--- /dev/null
+++ b/prepare
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+usage () {
+    cat << EOF
+    Usage: $(basename $0) branch_name version
+    This script is ment to be invoked in a CI environment only.
+
+EOF
+    exit 2
+}
+
+# TODO: check for `CI_COMMIT_SHORT_SHA` and `EXIST_UPLOAD_PW`; if not set, show warning that not in CI
+
+[[ $# -ne 2 ]] && { usage; }
+
+export BRANCH=$1
+export SR_PV=$2
+
+echo "Building $BRANCH environment $SR_PV..."
+./build
+exit $?
diff --git a/publish b/publish
new file mode 100755
index 0000000..4ed25ed
--- /dev/null
+++ b/publish
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+usage () {
+    cat << EOF
+    Usage: $(basename $0) file
+    This script is ment to be invoked in a CI environment only.
+
+EOF
+    exit 2
+}
+
+# TODO: check for `CI_COMMIT_SHORT_SHA` and/or `EXIST_UPLOAD_PW`; if not set, show warning that not in CI
+
+[[ $# -ne 1 ]] && { usage; }
+
+export FILE=$1
+
+echo "Uploading $FILE ..."
+curl -u ci:${EXIST_UPLOAD_PW} -X POST -F file=@${FILE} https://ci.de.dariah.eu/exist-upload
+exit $?
\ No newline at end of file
-- 
GitLab