From 5afb50b1e8a737a4b906d2cdda22888eca8468a7 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 9 Dec 2024 19:43:04 +0100 Subject: build: Add infrastructure --- scripts/download.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 scripts/download.sh (limited to 'scripts') 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 +# 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 . + +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}" -- cgit 1.4.1