summary refs log tree commit diff stats
path: root/scripts
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-09 19:43:04 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-09 19:43:04 +0100
commit5afb50b1e8a737a4b906d2cdda22888eca8468a7 (patch)
tree4e0372adb28d4185bf25472d377fd53d38d013e6 /scripts
downloadqmk_layout-5afb50b1e8a737a4b906d2cdda22888eca8468a7.zip
build: Add infrastructure
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/download.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/download.sh b/scripts/download.sh
new file mode 100755
index 0000000..097dbde
--- /dev/null
+++ b/scripts/download.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env sh
+
+# Moonlander Layout
+#
+# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
+# SPDX-License-Identifier: AGPL-3.0-or-later
+#
+# This file is part of Moonlander Layout.
+#
+# You should have received a copy of the License along with this program.
+# If not, see <https://www.gnu.org/licenses/agpl.txt>.
+
+LAYOUT_ID="KWBYA"
+LAYOUT_GEOMETRY="moonlander"
+
+data="$(mktemp)"
+echo
+cat << EOF > "$data"
+{ "query": "query getLayout(\$hashId: String!, \$revisionId: String!, \$geometry: String) {layout(hashId: \$hashId, geometry: \$geometry, revisionId: \$revisionId) {  revision { hashId, qmkVersion, title }}}","variables":{"hashId":"$LAYOUT_ID","geometry":"$LAYOUT_GEOMETRY","revisionId":"latest"}}
+EOF
+
+response="$(curl --location 'https://oryx.zsa.io/graphql' --header 'Content-Type: application/json' --data "$(cat "$data")" | jq '.data.layout.revision | [.hashId, .qmkVersion, .title]')"
+
+hash_id="$(echo "${response}" | jq -r '.[0]')"
+firmware_version=$(printf "%.0f" "$(echo "${response}" | jq -r '.[1]')")
+change_description=$(echo "${response}" | jq -r '.[2]')
+if [ -z "${change_description}" ]; then
+    change_description="latest layout modification made with Oryx"
+fi
+
+curl -L "https://oryx.zsa.io/source/${hash_id}" -o source.zip
+
+echo "firmware_version=${firmware_version}"
+echo "change_description=${change_description}"