summaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorOskar <oskar@mullvad.net>2025-02-05 15:55:37 +0100
committerOskar <oskar@mullvad.net>2025-02-05 15:55:37 +0100
commit612aad8d8d2ae779a4e5e01e85b2848b4fc7de3c (patch)
tree58d327c1d66f69db170d53816490744502d8e8f8 /scripts
parentdbfc02c1f64090efb7940279bdc4c8c9a98f0ac0 (diff)
parent04a80a4a674e236ffb295d16748e814fe3312dd9 (diff)
downloadmullvadvpn-612aad8d8d2ae779a4e5e01e85b2848b4fc7de3c.tar.xz
mullvadvpn-612aad8d8d2ae779a4e5e01e85b2848b4fc7de3c.zip
Merge branch 'improve-desktop-release-scripts'
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/utils/gh-ready-check22
-rwxr-xr-xscripts/utils/print-and-run9
2 files changed, 31 insertions, 0 deletions
diff --git a/scripts/utils/gh-ready-check b/scripts/utils/gh-ready-check
new file mode 100755
index 0000000000..164b5de903
--- /dev/null
+++ b/scripts/utils/gh-ready-check
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+
+# This script controls that the gh (GitHub CLI) command is installed and authenticated. This can be
+# called in the beginning of all scripts depending on gh.
+
+set -eu
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd "$SCRIPT_DIR"
+
+# shellcheck source=scripts/utils/log
+source ./log
+
+if ! command -v gh > /dev/null; then
+ log_error "gh (GitHub CLI) is required to run this script"
+ exit 1
+fi
+
+if ! gh auth status > /dev/null; then
+ log_error "Authentication through gh (GitHub CLI) is required to run this script"
+ exit 1
+fi
diff --git a/scripts/utils/print-and-run b/scripts/utils/print-and-run
new file mode 100755
index 0000000000..b323040f3c
--- /dev/null
+++ b/scripts/utils/print-and-run
@@ -0,0 +1,9 @@
+#!/usr/bin/env bash
+
+# This is a small utility script that can be sourced to provide a function that prints its arguments
+# and then calls them as a command, e.g. `print_and_run sleep 5`.
+
+function print_and_run {
+ echo "+ $*"
+ "$@"
+}