config: Update 2 files
This commit is contained in:
@@ -13,6 +13,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
platform:
|
platform:
|
||||||
- linux/amd64
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
58
publish.sh
58
publish.sh
@@ -2,19 +2,57 @@
|
|||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
#set projec to the folder this script is in.
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
PROJECT=$(basename "$SCRIPT_DIR")
|
|
||||||
SOS_DIR="${SCRIPT_DIR}/../sos"
|
|
||||||
|
|
||||||
# run sos to upload sos
|
ARCH=$(uname -m)
|
||||||
"${SOS_DIR}/sos" upload "getbin.xyz" "${SCRIPT_DIR}/${PROJECT}" "${PROJECT}:latest"
|
PROJECT="sos"
|
||||||
|
|
||||||
# publish the tool
|
function heading() {
|
||||||
GETPKG="${SCRIPT_DIR}/../getpkg/output/getpkg"
|
# print a heading with a line of dashe
|
||||||
[ -f "${GETPKG}" ] || die "Failed to find getpkg"
|
echo "--------------------------------"
|
||||||
|
echo "$1"
|
||||||
|
echo "--------------------------------"
|
||||||
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------
|
||||||
|
heading "Publishing ${PROJECT} as tool to ${PROJECT}:${ARCH} (on getpkg.xyz)"
|
||||||
|
|
||||||
|
# Generate version timestamp
|
||||||
|
VERSION=$(date -u +"%Y.%m%d.%H%M")
|
||||||
|
|
||||||
|
# Update version in the main sos script
|
||||||
|
echo "Updating version in main ${PROJECT} script to ${VERSION}..."
|
||||||
|
sed -i "s/^VERSION=\".*\"/VERSION=\"${VERSION}\"/" "${SCRIPT_DIR}/${PROJECT}"
|
||||||
|
|
||||||
|
# Copy the tool to the tool directory
|
||||||
TOOLDIR="${SCRIPT_DIR}/tool"
|
TOOLDIR="${SCRIPT_DIR}/tool"
|
||||||
mkdir -p "${TOOLDIR}"
|
mkdir -p "${TOOLDIR}"
|
||||||
cp "${SCRIPT_DIR}/${PROJECT}" "${TOOLDIR}/${PROJECT}"
|
cp "${SCRIPT_DIR}/${PROJECT}" "${TOOLDIR}/${PROJECT}"
|
||||||
"${GETPKG}" publish "${PROJECT}" "${TOOLDIR}"
|
|
||||||
|
# Print the version of the tool
|
||||||
|
echo "Version of the tool:"
|
||||||
|
"${TOOLDIR}/${PROJECT}" version
|
||||||
|
|
||||||
|
|
||||||
|
# Use getpkg to publish the tool - check standard location first
|
||||||
|
GETPKG="${HOME}/.local/bin/getpkg/getpkg"
|
||||||
|
if [ ! -f "$GETPKG" ]; then
|
||||||
|
GETPKG="${SCRIPT_DIR}/../getpkg/output/getpkg"
|
||||||
|
fi
|
||||||
|
if [ ! -f "$GETPKG" ]; then
|
||||||
|
GETPKG="${SCRIPT_DIR}/../getpkg/getpkg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -f "$GETPKG" ]; then
|
||||||
|
"${GETPKG}" publish "${PROJECT}:${ARCH}" "${TOOLDIR}"
|
||||||
|
else
|
||||||
|
echo "Warning: getpkg not found, skipping tool publishing to getpkg.xyz"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------
|
||||||
|
# run sos to upload sos, using the version with the datestamp.
|
||||||
|
"${SCRIPT_DIR}/sos" upload "getbin.xyz" "${TOOLDIR}/sos" "sos:latest"
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------------------
|
||||||
|
# Clean up tool directory
|
||||||
rm -rf "${TOOLDIR}"
|
rm -rf "${TOOLDIR}"
|
||||||
|
Reference in New Issue
Block a user