From eceb8e266c5b494d277a1f639ba0d0ef6db44a56 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 2 Sep 2025 20:41:11 +1200 Subject: [PATCH] Update 2 files --- gp | 2 +- publish.sh | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gp b/gp index cd050fd..d2b7376 100755 --- a/gp +++ b/gp @@ -494,7 +494,7 @@ case "${1:-}" in exit 0 ;; version) - echo "2025.0802.1112" + echo "__VERSION__" exit 0 ;; esac diff --git a/publish.sh b/publish.sh index 6a4c3e5..ef77884 100755 --- a/publish.sh +++ b/publish.sh @@ -1,9 +1,12 @@ +#!/bin/bash + set -euo pipefail SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" ARCH=$(uname -m) PROJECT="$(basename "${SCRIPT_DIR}")" OUTPUT="${SCRIPT_DIR}/output" +VERSION=$(date -u +"%Y.%m%d.%H%M") function heading() { @@ -45,7 +48,11 @@ heading "Publishing ${PROJECT} as tool to ${PROJECT}:${ARCH} (on getpkg.xyz)" TOOLDIR="${OUTPUT}/tool" mkdir "${TOOLDIR}" -cp "${PROJECT}" "${TOOLDIR}/${PROJECT}" + +# Copy the script and replace __VERSION__ with the actual version +sed "s|__VERSION__|${VERSION}|g" "${PROJECT}" > "${TOOLDIR}/${PROJECT}" +chmod +x "${TOOLDIR}/${PROJECT}" + "${GETPKG_PATH}" server set-token getpkg.xyz "${SOS_WRITE_TOKEN}" "${GETPKG_PATH}" publish "${PROJECT}:${ARCH}" "${TOOLDIR}" @@ -62,7 +69,7 @@ fi # Upload architecture-specific binary to getbin.xyz heading "Uploading ${PROJECT} binary to getbin.xyz as ${PROJECT}:latest-${ARCH}" -"${SOS}" upload "getbin.xyz" "${PROJECT}" "${PROJECT}:latest-${ARCH}" || die "Failed to upload ${PROJECT} binary to getbin.xyz" +"${SOS}" upload "getbin.xyz" "${TOOLDIR}/${PROJECT}" "${PROJECT}:latest-${ARCH}" || die "Failed to upload ${PROJECT} binary to getbin.xyz" # Check if there's an install script to upload if [ -f "${SCRIPT_DIR}/install.sh" ]; then