From 7fdf9bc4db129061821737db966ac5b27da9feb2 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Wed, 25 Jan 2023 22:37:43 -0700 Subject: [PATCH] Better publish scripts --- scripts/publish_shiv_package_github.sh | 22 ++++++++++++++++------ scripts/tag_new_release.sh | 17 +++++++++++++++++ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100755 scripts/tag_new_release.sh diff --git a/scripts/publish_shiv_package_github.sh b/scripts/publish_shiv_package_github.sh index 945a2efa..226b4f06 100755 --- a/scripts/publish_shiv_package_github.sh +++ b/scripts/publish_shiv_package_github.sh @@ -12,19 +12,29 @@ # ./scripts/publish_shiv_package_github.sh # In addition, a valid GitHub token must be defined in # CERC_PACKAGE_RELEASE_GITHUB_TOKEN +if [[ -z "${CERC_PACKAGE_RELEASE_GITHUB_TOKEN}" ]]; then + echo "CERC_PACKAGE_RELEASE_GITHUB_TOKEN is not set" >&2 + exit 1 +fi # TODO: check args and env vars major=$1 minor=$2 patch=$3 export PATH=$CERC_GH_RELEASE_SCRIPTS_DIR:$PATH -git_tag_manager.sh -M ${major} -m ${minor} -p ${patch} -t "Release ${major}.${minor}.${patch}" +github_org="cerc-io" +github_repository="stack-orchestrator" +latest_package=$(ls -1t ./package/* | head -1) +uploaded_package="./package/laconic-so" +# Remove any old package +rm ${uploaded_package} +cp ${latest_package} ${uploaded_package} github_release_manager.sh \ - -l david@bozemanpass.com -t ${CERC_PACKAGE_RELEASE_GITHUB_TOKEN} \ - -o cerc-io -r stack-orchestrator \ + -l notused -t ${CERC_PACKAGE_RELEASE_GITHUB_TOKEN} \ + -o ${github_org} -r ${github_repository} \ -d v${major}.${minor}.${patch} \ -c create github_release_manager.sh \ - -l david@bozemanpass.com -t ${CERC_PACKAGE_RELEASE_GITHUB_TOKEN} \ - -o cerc-io -r stack-orchestrator \ + -l notused -t ${CERC_PACKAGE_RELEASE_GITHUB_TOKEN} \ + -o ${github_org} -r ${github_repository} \ -d v${major}.${minor}.${patch} \ - -c upload ./package/laconic-so + -c upload ${uploaded_package} diff --git a/scripts/tag_new_release.sh b/scripts/tag_new_release.sh new file mode 100755 index 00000000..193b5d8a --- /dev/null +++ b/scripts/tag_new_release.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +# Usage: tag_new_release.sh +# Uses this script package to tag a new release: +# User must define: CERC_GH_RELEASE_SCRIPTS_DIR +# pointing to the location of that cloned repository +# e.g. +# cd ~/projects +# git clone https://github.com/cerc-io/github-release-api +# cd ./stack-orchestrator +# export CERC_GH_RELEASE_SCRIPTS_DIR=~/projects/github-release-api +# ./scripts/publish_shiv_package_github.sh +# TODO: check args and env vars +major=$1 +minor=$2 +patch=$3 +export PATH=$CERC_GH_RELEASE_SCRIPTS_DIR:$PATH +git_tag_manager.sh -M ${major} -m ${minor} -p ${patch} -t "Release ${major}.${minor}.${patch}"