Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | eb84a63 | 2024-03-21 13:36:32 -0400 | [diff] [blame] | 3 | # Copyright 2018-2024 Open Networking Foundation Contributors |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
Joey Armstrong | eb84a63 | 2024-03-21 13:36:32 -0400 | [diff] [blame] | 9 | # http:#www.apache.org/licenses/LICENSE-2.0 |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
Joey Armstrong | eb84a63 | 2024-03-21 13:36:32 -0400 | [diff] [blame] | 16 | # ----------------------------------------------------------------------- |
| 17 | # SPDX-FileCopyrightText: 2018-2024 Open Networking Foundation Contributors |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ----------------------------------------------------------------------- |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 20 | # github-release.sh |
| 21 | # builds (with make) and uploads release artifacts (binaries, etc.) to github |
| 22 | # given a tag also create checksums files and release notes from the commit |
| 23 | # message |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 24 | # ----------------------------------------------------------------------- |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 25 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 26 | set -euo pipefail |
| 27 | |
| 28 | ##-------------------## |
| 29 | ##---] GLOBALS [---## |
| 30 | ##-------------------## |
| 31 | declare -g WORKSPACE |
| 32 | declare -g GERRIT_PROJECT |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 33 | declare -g __githost=github.com |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 34 | # export DEBUG=1 |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 35 | |
| 36 | ## ----------------------------------------------------------------------- |
| 37 | ## Uncomment to activate |
| 38 | ## ----------------------------------------------------------------------- |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 39 | # Debug arguments |
| 40 | # declare -i -g argv_gen_version=1 |
| 41 | # declare -i -g draft_release=1 |
Joey Armstrong | 41923cc | 2023-01-30 14:38:16 -0500 | [diff] [blame] | 42 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 43 | declare -a -g ARGV=() # Capture args to minimize globals and arg passing |
| 44 | [[ $# -gt 0 ]] && ARGV=("$@") |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 45 | |
| 46 | declare -g scratch # temp workspace for downloads |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 47 | |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 48 | declare -g SCRIPT_VERSION='1.4' # git changeset needed |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 49 | |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 50 | ##--------------------## |
| 51 | ##---] INCLUDES [---## |
Joey Armstrong | 1962bcf | 2023-01-27 13:53:18 -0500 | [diff] [blame] | 52 | ##--------------------# |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 53 | |
| 54 | ## ----------------------------------------------------------------------- |
| 55 | ## Intent: Register an interrupt handler to display a stack trace on error |
| 56 | ## ----------------------------------------------------------------------- |
| 57 | function errexit() |
| 58 | { |
| 59 | local err=$? |
| 60 | set +o xtrace |
| 61 | local code="${1:-1}" |
| 62 | |
| 63 | local prefix="${BASH_SOURCE[1]}:${BASH_LINENO[0]}" |
| 64 | echo -e "\nOFFENDER: ${prefix}" |
| 65 | if [ $# -gt 0 ] && [ "$1" == '--stacktrace-quiet' ]; then |
| 66 | code=1 |
| 67 | else |
| 68 | echo "ERROR: '${BASH_COMMAND}' exited with status $err" |
| 69 | fi |
| 70 | |
| 71 | # Print out the stack trace described by $function_stack |
| 72 | if [ ${#FUNCNAME[@]} -gt 2 ] |
| 73 | then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 74 | echo "Call tree:" |
| 75 | for ((i=1;i<${#FUNCNAME[@]}-1;i++)) |
| 76 | do |
| 77 | echo " $i: ${BASH_SOURCE[$i+1]}:${BASH_LINENO[$i]} ${FUNCNAME[$i]}(...)" |
| 78 | done |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 79 | fi |
| 80 | |
| 81 | echo "Exiting with status ${code}" |
| 82 | echo |
| 83 | exit "${code}" |
| 84 | # return |
| 85 | } |
| 86 | |
| 87 | # trap ERR to provide an error handler whenever a command exits nonzero |
| 88 | # this is a more verbose version of set -o errexit |
| 89 | trap errexit ERR |
| 90 | |
| 91 | # setting errtrace allows our ERR trap handler to be propagated to functions, |
| 92 | # expansions and subshells |
| 93 | set -o errtrace |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 94 | |
| 95 | ## ----------------------------------------------------------------------- |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 96 | ## Intent: Cleanup scratch area on exit |
| 97 | ## ----------------------------------------------------------------------- |
| 98 | function sigtrap() |
| 99 | { |
| 100 | ## Prevent mishaps |
| 101 | local is_read_only |
| 102 | is_read_only="$(declare -p scratch)" |
| 103 | if [[ $is_read_only != *"declare -r scratch="* ]]; then |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 104 | echo "ERROR: variable scratch is not read-only, cleanup skipped" |
| 105 | exit 1 |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 106 | fi |
| 107 | |
| 108 | if [ -d "$scratch" ]; then |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 109 | /bin/rm -fr "$scratch" |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 110 | fi |
| 111 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 112 | do_logout 'shellcheck-SC2119' |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 113 | return |
| 114 | } |
| 115 | trap sigtrap EXIT |
| 116 | |
| 117 | ## ----------------------------------------------------------------------- |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 118 | ## Intent: Return a random release version string. |
| 119 | ## ----------------------------------------------------------------------- |
| 120 | ## Note: Do not use this function in production. get_version() is |
| 121 | ## intended for local use or debugging $0 from within a jenkins |
| 122 | ## job. |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 123 | ## ----------------------------------------------------------------------- |
| 124 | function get_version() |
| 125 | { |
| 126 | declare -n ref="$1" |
| 127 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 128 | declare -a rev=() |
| 129 | rev+=("$(( RANDOM % 10 + 1 ))") |
| 130 | rev+=("$(( RANDOM % 256 + 1 ))") |
Joey Armstrong | eef8c2c | 2023-03-27 17:27:43 -0400 | [diff] [blame] | 131 | rev+=("$(( RANDOM % 10000 + 1 ))") |
Joey Armstrong | fc20ed5 | 2023-04-03 19:37:58 -0400 | [diff] [blame] | 132 | local ver="v${rev[0]}.${rev[1]}.${rev[2]}" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 133 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 134 | func_echo "VERSION: $ver" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 135 | ref="$ver" |
| 136 | return |
| 137 | } |
| 138 | |
| 139 | ## ----------------------------------------------------------------------- |
| 140 | ## Intent: Provide defaults for environment variables |
| 141 | ## ----------------------------------------------------------------------- |
| 142 | function initEnvVars() |
| 143 | { |
| 144 | # when not running under Jenkins, use current dir as workspace and a blank |
| 145 | # project name |
| 146 | declare -g WORKSPACE=${WORKSPACE:-.} |
| 147 | declare -g GERRIT_PROJECT=${GERRIT_PROJECT:-} |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 148 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 149 | # Github organization (or user) this project is published on. Project name should |
| 150 | # be the same on both Gerrit and GitHub |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 151 | declare -g GITHUB_ORGANIZATION=${GITHUB_ORGANIZATION:-} |
| 152 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 153 | # glob pattern relative to project dir matching release artifacts |
| 154 | # ARTIFACT_GLOB=${ARTIFACT_GLOB:-"release/*"} # stat -- release/* not found, literal string (?) |
| 155 | declare -g ARTIFACT_GLOB=${ARTIFACT_GLOB:-"release/."} |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 156 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 157 | # Use "release" as the default makefile target, can be a space separated list |
| 158 | declare -g RELEASE_TARGETS=${RELEASE_TARGETS:-release} |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 159 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 160 | # Set and handle GOPATH and PATH |
| 161 | export GOPATH=${GOPATH:-$WORKSPACE/go} |
| 162 | export PATH=$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:$GOPATH/bin |
| 163 | return |
| 164 | } |
| 165 | |
| 166 | ## ----------------------------------------------------------------------- |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 167 | ## Intent: Create a scratch area for downloads and transient tools |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 168 | ## temp directory will be automatically removed upon exit. |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 169 | ## ----------------------------------------------------------------------- |
| 170 | function init() |
| 171 | { |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 172 | local pkgbase="${0##*/}" # basename |
| 173 | local pkgname="${pkgbase%.*}" |
| 174 | |
Joey Armstrong | ad7b1e0 | 2023-03-27 11:55:48 -0400 | [diff] [blame] | 175 | # initEnvVars # moved to full_banner() |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 176 | |
| 177 | ## Create a temp directory for auto-cleanup |
| 178 | declare -g scratch |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 179 | scratch="$(mktemp -d -t "${pkgname}.XXXXXXXXXX")" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 180 | readonly scratch |
| 181 | declare -p scratch |
| 182 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 183 | ## prime the stream: cache answers |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 184 | local work |
| 185 | get_release_dir work |
| 186 | declare -p work |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 187 | |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 188 | local git_version |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 189 | getGitVersion git_version |
| 190 | func_echo "$(declare -p git_version)" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 191 | return |
| 192 | } |
| 193 | |
| 194 | ## ----------------------------------------------------------------------- |
| 195 | ## Intent: Verbose output for logging |
| 196 | ## ----------------------------------------------------------------------- |
| 197 | function banner() |
| 198 | { |
| 199 | local iam="${0##*/}" |
| 200 | cat <<EOB |
| 201 | |
| 202 | ** ----------------------------------------------------------------------- |
| 203 | ** ${iam}::${FUNCNAME[1]}: $* |
| 204 | ** ----------------------------------------------------------------------- |
| 205 | EOB |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 209 | ## Intent: Output a log banner to identify the running script/version. |
| 210 | ## ----------------------------------------------------------------------- |
| 211 | ## TODO: |
| 212 | ## o SCRIPT_VERSION => git changeset for repo:ci-managment |
| 213 | ## o echo "library version: ${env."library.libName.version"}" |
| 214 | # ----------------------------------------------------------------------- |
| 215 | # 14:18:38 > git fetch --no-tags --progress -- https://gerrit.opencord.org/ci-management.git +refs/heads/*:refs/remotes/origin/* # timeout=10 |
| 216 | # 14:18:39 Checking out Revision 50f6e0b97f449b32d32ec0e02d59642000351847 (master) |
| 217 | # ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 218 | function full_banner() |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 219 | { |
Joey Armstrong | ad7b1e0 | 2023-03-27 11:55:48 -0400 | [diff] [blame] | 220 | local iam="${0##*/}" |
| 221 | |
| 222 | initEnvVars # set defaults |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 223 | |
| 224 | cat <<EOH |
| 225 | |
| 226 | ** ----------------------------------------------------------------------- |
| 227 | ** IAM: ${iam} :: ${FUNCNAME[0]} |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 228 | ** ARGV: ${ARGV[@]} |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 229 | ** PWD: $(/bin/pwd) |
| 230 | ** NOW: $(date '+%Y/%m/%d %H:%M:%S') |
| 231 | ** VER: ${SCRIPT_VERSION:-'unknown'} |
| 232 | ** ----------------------------------------------------------------------- |
Joey Armstrong | ad7b1e0 | 2023-03-27 11:55:48 -0400 | [diff] [blame] | 233 | ** GERRIT_PROJECT: $(declare -p GERRIT_PROJECT) |
| 234 | ** GITHUB_ORGANIZATION: $(declare -p GITHUB_ORGANIZATION) |
| 235 | ** RELEASE_TARGETS: $(declare -p RELEASE_TARGETS) |
| 236 | ** GOPATH: $(declare -p GOPATH) |
| 237 | ** ----------------------------------------------------------------------- |
| 238 | ** PATH += /usr/lib/go-1.12/bin:/usr/local/go/bin:GOPATH/bin |
| 239 | ** ----------------------------------------------------------------------- |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 240 | EOH |
| 241 | |
| 242 | return |
| 243 | } |
| 244 | |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 245 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 246 | ## Intent: Display a message with 'iam' identifier for logging |
Joey Armstrong | 50f6e0b | 2023-01-24 14:14:08 -0500 | [diff] [blame] | 247 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 248 | function func_echo() |
Joey Armstrong | 1962bcf | 2023-01-27 13:53:18 -0500 | [diff] [blame] | 249 | { |
| 250 | local iam="${0##*/}" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 251 | echo "** ${iam} :: ${FUNCNAME[1]}: $*" |
Joey Armstrong | 1962bcf | 2023-01-27 13:53:18 -0500 | [diff] [blame] | 252 | return |
| 253 | } |
| 254 | |
| 255 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 256 | ## Intent: Display an error message then exit with status. |
| 257 | ## ----------------------------------------------------------------------- |
| 258 | function error() |
| 259 | { |
| 260 | local iam="${0##*/}" |
| 261 | echo "ERROR ${iam} :: ${FUNCNAME[1]}: $*" |
| 262 | exit 1 |
| 263 | } |
| 264 | |
| 265 | ## ----------------------------------------------------------------------- |
| 266 | ## Intent: Verify sandbox/build is versioned for release. |
| 267 | ## ----------------------------------------------------------------------- |
| 268 | function getGitVersion() |
| 269 | { |
| 270 | declare -n varname="$1"; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 271 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 272 | local __ver # use prefix('__') to protect callers variable name |
| 273 | if [[ -v cached_getGitVersion ]]; then |
| 274 | __ver="$cached_getGitVersion" |
| 275 | varname="$__ver" |
| 276 | return |
Joey Armstrong | 39fac65 | 2023-03-27 18:50:43 -0400 | [diff] [blame] | 277 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 278 | elif [[ -v argv_gen_version ]]; then |
| 279 | get_version __ver |
| 280 | |
| 281 | elif [[ -v WORKSPACE ]] && [[ -v GITHUB_TOKEN ]]; then # i_am_jenkins |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 282 | local path="$GERRIT_PROJECT" |
| 283 | pushd "$path" || error "pushd GERRIT_PROJECT= failed $(declare -p path)" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 284 | __ver="$(git tag -l --points-at HEAD)" |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 285 | popd || error "popd GERRIT_PROJECT= failed" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 286 | |
| 287 | elif [[ -v argv_version_file ]]; then # local debug |
| 288 | [[ ! -f VERSION ]] && error "./VERSION file not found" |
| 289 | readarray -t tmp < <(sed -e 's/[[:blank:]]//g' 'VERSION') |
| 290 | __ver="v${tmp[0]}" |
| 291 | |
| 292 | else |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 293 | cd .. |
| 294 | local path="$GERRIT_PROJECT" |
| 295 | pushd "$path" || error "pushd GERRIT_PROJECT= failed $(declare -p path)" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 296 | __ver="$(git tag -l --points-at HEAD)" |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 297 | popd || error "popd GERRIT_PROJECT= failed" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 298 | fi |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 299 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 300 | # ------------------------------------------------------ |
| 301 | # match bare versions or v-prefixed golang style version |
| 302 | # Critical failure for new/yet-to-be-released repo ? |
| 303 | # ------------------------------------------------------ |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 304 | if [[ "$__ver" =~ ^v?([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then |
Joey Armstrong | fc20ed5 | 2023-04-03 19:37:58 -0400 | [diff] [blame] | 305 | echo "git has a SemVer released version tag: '$__ver'" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 306 | echo "Building artifacts for GitHub release." |
| 307 | |
| 308 | elif [[ "$__ver" =~ ^v?([0-9]+)\.([0-9]+)\.([0-9]+)-dev([0-9]+)$ ]]; then |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 309 | # v1.2.3-dev (*-dev*) is an implicit draft release. |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 310 | declare -i -g draft_release=1 |
| 311 | echo "Detected --draft SemVer release version tag [$__ver]" |
| 312 | echo "Building artifacts for GitHub release." |
| 313 | |
Joey Armstrong | 4f87de8 | 2023-08-25 12:42:39 -0400 | [diff] [blame] | 314 | # Should also accept: X.Y.Z-{alpha,beta,...} |
| 315 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 316 | else |
Joey Armstrong | 4f87de8 | 2023-08-25 12:42:39 -0400 | [diff] [blame] | 317 | echo "Version string contains: [${__ver}]" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 318 | error "No SemVer released version tag found, exiting..." |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 319 | fi |
| 320 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 321 | ## Cache value for subsequent calls. |
| 322 | ## readonly is a guarantee assignment happens once. |
| 323 | declare -g cached_getGitVersion="$__ver" |
| 324 | readonly cached_getGitVersion; |
| 325 | |
| 326 | varname="$__ver" |
| 327 | func_echo "Version is [$__ver] from $(/bin/pwd)" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 328 | return |
| 329 | } |
| 330 | |
| 331 | ## ----------------------------------------------------------------------- |
| 332 | ## Intent: |
| 333 | ## Note: Release description is sanitized version of the log message |
| 334 | ## ----------------------------------------------------------------------- |
| 335 | function getReleaseDescription() |
| 336 | { |
| 337 | declare -n varname="$1"; shift |
| 338 | |
| 339 | local msg |
| 340 | msg="$(git log -1 --pretty=%B)" |
| 341 | |
| 342 | local val |
| 343 | val="$(tr -dc "[:alnum:]\n\r\.\[\]\:\-\\\/\`\' " <<< "$msg")" |
| 344 | |
| 345 | [[ ${#val} -eq 0 ]] && error "Release Description is empty ($msg)" |
| 346 | varname="$val" |
| 347 | return |
| 348 | } |
| 349 | |
| 350 | ## ----------------------------------------------------------------------- |
| 351 | ## Intent: Retrieve value of the release temp directory. |
| 352 | ## ----------------------------------------------------------------------- |
| 353 | ## Note: Limit use of globals so logic can be isolated in function calls. |
| 354 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 355 | function get_release_dir() |
| 356 | { |
| 357 | declare -n varname=$1; shift |
| 358 | |
| 359 | # Temporary staging directory to copy artifacts to |
| 360 | varname="$scratch/release" |
| 361 | mkdir -p "$varname" |
| 362 | return |
| 363 | } |
| 364 | |
| 365 | ## ----------------------------------------------------------------------- |
| 366 | ## Intent: Retrieve github server hostname |
| 367 | ## ----------------------------------------------------------------------- |
| 368 | function get_gh_hostname() |
| 369 | { |
| 370 | declare -n varname=$1; shift |
| 371 | varname+=('--hostname' "${__githost}") |
| 372 | return |
| 373 | } |
| 374 | |
| 375 | ## ----------------------------------------------------------------------- |
| 376 | ## Intent: Retrieve repository organizaiton name |
| 377 | ## ----------------------------------------------------------------------- |
| 378 | function get_gh_repo_org() |
| 379 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 380 | declare -n ref=$1; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 381 | declare -g __repo_org |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 382 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 383 | local org |
| 384 | if [[ -v __repo_org ]]; then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 385 | org="$__repo_org" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 386 | elif [[ ! -v GITHUB_ORGANIZATION ]]; then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 387 | error "--repo-org or GITHUB_ORGANIZATION= are required" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 388 | else |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 389 | org="${GITHUB_ORGANIZATION}" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 390 | fi |
| 391 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 392 | ref="$org" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 393 | return |
| 394 | } |
| 395 | |
| 396 | ## ----------------------------------------------------------------------- |
| 397 | ## Intent: Retrieve repository organizaiton name |
| 398 | ## ----------------------------------------------------------------------- |
| 399 | function get_gh_repo_name() |
| 400 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 401 | declare -n ref=$1; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 402 | declare -g __repo_name |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 403 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 404 | local name |
| 405 | if [[ -v __repo_name ]]; then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 406 | name="$__repo_name" |
Joey Armstrong | 39fac65 | 2023-03-27 18:50:43 -0400 | [diff] [blame] | 407 | elif [[ ! -v GERRIT_PROJECT ]]; then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 408 | error "--repo-name or GERRIT_PROJECT= are required" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 409 | else |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 410 | name="${GERRIT_PROJECT}" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 411 | fi |
| 412 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 413 | ref="$name" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 414 | return |
| 415 | } |
| 416 | |
| 417 | ## ----------------------------------------------------------------------- |
| 418 | ## Intent: Return path for the gh release query |
| 419 | ## ----------------------------------------------------------------------- |
| 420 | function get_gh_releases() |
| 421 | { |
| 422 | declare -n ref="$1" |
| 423 | |
| 424 | local repo_org |
| 425 | get_gh_repo_org repo_org |
| 426 | |
| 427 | local repo_name |
| 428 | get_gh_repo_name repo_name |
| 429 | |
| 430 | ref="repos/${repo_org}/${repo_name}/releases" |
| 431 | func_echo "ref=$ref" |
| 432 | return |
| 433 | } |
| 434 | |
| 435 | ## ----------------------------------------------------------------------- |
| 436 | ## Intent: Retrieve repository path argument |
| 437 | ## ----------------------------------------------------------------------- |
| 438 | function get_argv_repo() |
| 439 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 440 | declare -n ref=$1; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 441 | |
| 442 | local repo_org |
| 443 | get_gh_repo_org repo_org |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 444 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 445 | local repo_name |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 446 | get_gh_repo_name repo_name |
| 447 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 448 | ref="${repo_org}/${repo_name}" |
| 449 | # func_echo "ref=$(declare -p ref)" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 450 | return |
| 451 | } |
| 452 | |
| 453 | ## ----------------------------------------------------------------------- |
| 454 | ## Intent: Retrieve release name string "project - version" |
| 455 | ## ----------------------------------------------------------------------- |
| 456 | function get_argv_name() |
| 457 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 458 | declare -n ref=$1; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 459 | |
| 460 | local repo_name |
| 461 | get_gh_repo_name repo_name |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 462 | |
| 463 | local repo_ver |
| 464 | getGitVersion repo_ver |
| 465 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 466 | # ref="${repo_name} - $GIT_VERSION" |
| 467 | ref="${repo_name} - ${repo_ver}" |
| 468 | func_echo "ref=$(declare -p ref)" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 469 | return |
| 470 | } |
| 471 | |
| 472 | ## ----------------------------------------------------------------------- |
| 473 | ## Intent: Retrieve tag version |
| 474 | ## ----------------------------------------------------------------------- |
| 475 | function get_argv_tag() |
| 476 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 477 | declare -n ref=$1; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 478 | |
| 479 | # cached_argv_tag='v3.41.3204' |
| 480 | if [[ ! -v cached_argv_tag ]]; then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 481 | declare -g cached_argv_tag |
| 482 | if [[ -v GIT_VERSION ]]; then # hello jenkins |
| 483 | cached_argv_tag="$GIT_VERSION" |
| 484 | fi |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 485 | fi |
| 486 | |
| 487 | [[ ${#cached_argv_tag} -eq 0 ]] && error "Unable to determine GIT_VERSION=" |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 488 | ref="$cached_argv_tag" |
| 489 | func_echo "ref=$(declare -p ref)" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 490 | return |
| 491 | } |
| 492 | |
| 493 | ## ----------------------------------------------------------------------- |
| 494 | ## Intent: |
| 495 | ## ----------------------------------------------------------------------- |
| 496 | # To support golang projects that require GOPATH to be set and code checked out there |
| 497 | # If $DEST_GOPATH is not an empty string: |
| 498 | # - create GOPATH within WORKSPACE, and destination directory within |
| 499 | # - set PATH to include $GOPATH/bin and the system go binaries |
| 500 | # - move project from $WORKSPACE/$GERRIT_PROJECT to new location in $GOPATH |
| 501 | # - start release process within that directory |
| 502 | ## ----------------------------------------------------------------------- |
| 503 | function get_release_path() |
| 504 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 505 | declare -n ref=$1; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 506 | |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 507 | # shellcheck disable=SC2128 |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 508 | local varpath="$ref" |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 509 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 510 | DEST_GOPATH=${DEST_GOPATH:-} |
| 511 | if [ -n "$DEST_GOPATH" ]; then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 512 | mkdir -p "$GOPATH/src/$DEST_GOPATH" |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 513 | varpath="$GOPATH/src/$DEST_GOPATH/$GERRIT_PROJECT" |
| 514 | mv "$WORKSPACE/$GERRIT_PROJECT" "$varpath" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 515 | else |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 516 | varpath="$WORKSPACE/$GERRIT_PROJECT" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 517 | fi |
| 518 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 519 | ## Verify pwd is OK |
| 520 | for path in \ |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 521 | "${varpath}/Makefile"\ |
| 522 | "${varpath}/makefile"\ |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 523 | "__ERROR__"\ |
| 524 | ; do |
| 525 | case "$path" in |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 526 | __ERROR__) error "Makefile not found at ${varpath} !" ;; |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 527 | *) [[ -f "$path" ]] && break ;; |
| 528 | esac |
| 529 | done |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 530 | |
| 531 | return |
| 532 | } |
| 533 | |
| 534 | ## ----------------------------------------------------------------------- |
| 535 | ## Intent: Display future enhancements |
| 536 | ## ----------------------------------------------------------------------- |
| 537 | function todo() |
| 538 | { |
| 539 | local iam="${0##*/}" |
| 540 | |
| 541 | cat <<EOT |
| 542 | |
| 543 | ** ----------------------------------------------------------------------- |
| 544 | ** IAM: ${iam} :: ${FUNCNAME[0]} |
| 545 | ** ----------------------------------------------------------------------- |
| 546 | o get_release_path() |
| 547 | - refactor redundant paths into local vars. |
| 548 | - see comments, do we have a one-off failure condition ? |
Joey Armstrong | ad7b1e0 | 2023-03-27 11:55:48 -0400 | [diff] [blame] | 549 | o PATH += golang appended 3 times, release needs a single, reliable answer. |
| 550 | o do_login, do_logout and api calls do not use the my_gh wrapper: |
| 551 | - Add a lookup function to cache and retrieve path to downloaded gh command. |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 552 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 553 | EOT |
| 554 | |
| 555 | return |
| 556 | } |
| 557 | |
| 558 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 559 | ## Intent: Verify a directory contains content for release. |
| 560 | ## ----------------------------------------------------------------------- |
| 561 | ## Given: |
| 562 | ## scalar Path to release/ directory |
| 563 | ## ref Results returned through this indirect var. |
| 564 | ## ----------------------------------------------------------------------- |
| 565 | ## Usage: |
| 566 | ## declare -a artifacts=() |
| 567 | ## get_artifacts '/foo/bar/tans' artifacts |
| 568 | ## declare -p artifacts |
| 569 | ## ----------------------------------------------------------------------- |
| 570 | function get_artifacts() |
| 571 | { |
| 572 | local dir="$1" ; shift |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 573 | declare -n refA=$1 ; shift |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 574 | |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 575 | # Glob available files, exclude checksums |
| 576 | readarray -t __artifacts < <(find "$dir" -mindepth 1 ! -type d \ |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 577 | | grep -iv -e 'sum256' -e 'checksum') |
| 578 | # func_echo "$(declare -p __artifacts)" |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 579 | |
| 580 | # ----------------------------------------------------------------------- |
| 581 | # Verify count>0 to inhibit source-only release |
| 582 | # Problem children: |
| 583 | # o build or make release failures. |
| 584 | # o docker container filesystem mount problem (~volume) |
| 585 | # ----------------------------------------------------------------------- |
| 586 | [[ ${#__artifacts[@]} -eq 0 ]] \ |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 587 | && error "Artifact dir is empty: $(declare -p dir)" |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 588 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 589 | # shellcheck disable=SC2034 |
| 590 | refA=("${__artifacts[@]}") |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 591 | return |
| 592 | } |
| 593 | |
| 594 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 595 | ## Intent: Copy files from the build directory into the release staging |
| 596 | ## directory for publishing to github releases/ endpoint. |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 597 | ## ----------------------------------------------------------------------- |
| 598 | function copyToRelease() |
| 599 | { |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 600 | banner '' |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 601 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 602 | local artifact_glob="${ARTIFACT_GLOB%/*}" |
| 603 | func_echo "$(declare -p artifact_glob)" |
| 604 | |
| 605 | local work |
| 606 | get_release_dir work |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 607 | func_echo "Artifact dir: $(declare -p work)" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 608 | |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 609 | ## Verify release content is available |
| 610 | declare -a artifacts=() |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 611 | # get_artifacts "$work" artifacts |
| 612 | get_artifacts "$artifact_glob" artifacts |
| 613 | func_echo "Artifacts in copy_from: $(declare -p artifacts)" |
Joey Armstrong | 472bfba | 2023-03-27 18:12:28 -0400 | [diff] [blame] | 614 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 615 | # Copy artifacts into the release temp dir |
| 616 | # shellcheck disable=SC2086 |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 617 | echo "rsync -rv --checksum \"$artifact_glob/.\" \"$work/.\"" |
| 618 | rsync -rv --checksum "$artifact_glob/." "$work/." |
Joey Armstrong | 1962bcf | 2023-01-27 13:53:18 -0500 | [diff] [blame] | 619 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 620 | get_artifacts "$work" artifacts |
| 621 | func_echo "Artifacts in copy_to: $(declare -p artifacts)" |
| 622 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 623 | return |
| 624 | } |
| 625 | |
| 626 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 627 | ## https://docs.github.com/en/rest/releases?apiVersion=2022-11-28 |
| 628 | # https://cli.github.com/manual/gh_release_create |
| 629 | # --target <branch> or commit SHA |
| 630 | # --title |
| 631 | # --generate-notes |
| 632 | # --release-notes (notes file) |
| 633 | # --release |
| 634 | # release create dist/*.tgz |
| 635 | # --discussion-category "General" |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 636 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 637 | # https://cli.github.com/manual/gh_release_create |
| 638 | ## ----------------------------------------------------------------------- |
| 639 | function gh_release_create() |
Joey Armstrong | 38bfeea | 2023-02-06 18:01:29 -0500 | [diff] [blame] | 640 | { |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 641 | banner '' |
Joey Armstrong | 38bfeea | 2023-02-06 18:01:29 -0500 | [diff] [blame] | 642 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 643 | local version |
| 644 | getGitVersion version |
Joey Armstrong | 38bfeea | 2023-02-06 18:01:29 -0500 | [diff] [blame] | 645 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 646 | local work |
| 647 | get_release_dir work |
| 648 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 649 | declare -a args=() |
| 650 | args+=('--host-repo') |
| 651 | args+=('--title') |
| 652 | if [[ -v draft_release ]]; then |
| 653 | args+=('--draft') |
| 654 | else |
| 655 | args+=('--discussion-category' 'Announcements') |
| 656 | fi |
| 657 | |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 658 | if [[ -v release_notes ]]; then |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 659 | args+=('--notes-file' "$release_notes") |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 660 | fi |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 661 | |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 662 | pushd "$work/.." >/dev/null |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 663 | # func_echo "WORK=$work" |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 664 | readarray -t payload < <(find 'release' -maxdepth 4 ! -type d -print) |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 665 | |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 666 | func_echo "$gh_cmd release create ${version} ${args[*]} ${payload[*]}" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 667 | |
| 668 | if [[ -v dry_run ]]; then |
| 669 | echo "[SKIP] dry run" |
| 670 | else |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 671 | func_echo "my_gh release create '$version' ${args[*]} ${payload[*]}" |
Joey Armstrong | 4dbe700 | 2023-04-04 12:47:38 -0400 | [diff] [blame] | 672 | my_gh 'release' 'create' "$version" "${args[@]}" "${payload[@]}" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 673 | fi |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 674 | popd >/dev/null |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 675 | |
Joey Armstrong | 38bfeea | 2023-02-06 18:01:29 -0500 | [diff] [blame] | 676 | return |
| 677 | } |
| 678 | |
| 679 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 680 | ## Intent: Authenticate credentials for a github gh session |
Joey Armstrong | 38bfeea | 2023-02-06 18:01:29 -0500 | [diff] [blame] | 681 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 682 | ## NOTE: my_gh currently unused due to --with-token < "$pac" |
| 683 | ## ----------------------------------------------------------------------- |
| 684 | function do_login() |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 685 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 686 | # shellcheck disable=SC2120 |
| 687 | # shellcheck disable=SC2034 |
| 688 | local unused="$1"; shift |
| 689 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 690 | declare -g pac |
Joey Armstrong | 485081f | 2023-03-27 13:34:08 -0400 | [diff] [blame] | 691 | declare -a login_args=() |
| 692 | [[ $# -gt 0 ]] && login_args+=("$@") |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 693 | |
Joey Armstrong | 485081f | 2023-03-27 13:34:08 -0400 | [diff] [blame] | 694 | # https://github.com/cli/cli/issues/2922#issuecomment-775027762 |
Joey Armstrong | 75a0d93 | 2023-03-28 08:59:54 -0400 | [diff] [blame] | 695 | # (sigh) why not quietly return VS forcing a special logic path |
Joey Armstrong | e6e18eb | 2023-03-27 14:19:21 -0400 | [diff] [blame] | 696 | # [[ -v WORKSPACE ]] && [[ -v GITHUB_TOKEN ]] && return |
| 697 | |
| 698 | # 12:58:36 ** ----------------------------------------------------------------------- |
| 699 | # 12:58:36 ** jenkins582353203049151829.sh::do_login: --hostname github.com |
| 700 | # 12:58:36 ** --------------------------------------------------------------------# --- |
| 701 | # 12:58:36 ** jenkins582353203049151829.sh :: do_login: Detected ENV{GITHUB_TOKEN}= |
| 702 | # 12:58:36 The value of the GITHUB_TOKEN environment variable is being used for authentication. |
| 703 | # 12:58:36 To have GitHub CLI store credentials instead, first clear the value from the environment. |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 704 | # ----------------------------------------------------------------------- |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 705 | |
Joey Armstrong | 485081f | 2023-03-27 13:34:08 -0400 | [diff] [blame] | 706 | get_gh_hostname login_args |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 707 | |
Joey Armstrong | 485081f | 2023-03-27 13:34:08 -0400 | [diff] [blame] | 708 | banner "${login_args[@]}" |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 709 | func_echo "$(declare -p WORKSPACE)" |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 710 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 711 | ## Read from disk is safer than export GITHUB_TOKEN= |
| 712 | if [[ -v pac ]] && [[ ${#pac} -gt 0 ]]; then # interactive/debugging |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 713 | [ ! -f "$pac" ] && error "PAC token file $pac does not exist" |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 714 | func_echo "$gh_cmd auth login ${login_args[*]} --with-token < $pac" |
Joey Armstrong | 485081f | 2023-03-27 13:34:08 -0400 | [diff] [blame] | 715 | "$gh_cmd" auth login "${login_args[@]}" --with-token < "$pac" |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 716 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 717 | elif [[ ! -v GITHUB_TOKEN ]]; then |
| 718 | error "--token [t] or GITHUB_TOKEN= are required" |
Joey Armstrong | 41923cc | 2023-01-30 14:38:16 -0500 | [diff] [blame] | 719 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 720 | else # jenkins |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 721 | func_echo "$gh_cmd auth login ${login_args[*]} (ie: jenkins)" |
Joey Armstrong | 733ea9f | 2023-04-03 21:19:46 -0400 | [diff] [blame] | 722 | |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 723 | # https://github.com/cli/cli/issues/2922#issuecomment-775027762 |
| 724 | # When using GITHUB_TOKEN, there is no need to even run gh auth login |
Joey Armstrong | 733ea9f | 2023-04-03 21:19:46 -0400 | [diff] [blame] | 725 | # "$gh_cmd" auth login "${login_args[@]}" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 726 | fi |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 727 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 728 | declare -i -g active_login=1 # signal logout needed |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 729 | |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 730 | return |
| 731 | } |
| 732 | |
| 733 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 734 | ## Intent: Destroy credentials/gh session authenticated by do_login |
| 735 | ## ----------------------------------------------------------------------- |
| 736 | ## NOTE: my_gh currently unused due to "<<< 'y'" |
| 737 | ## ----------------------------------------------------------------------- |
| 738 | function do_logout() |
| 739 | { |
| 740 | declare -i -g active_login |
| 741 | [[ ! -v active_login ]] && return |
| 742 | |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 743 | declare -a logout_args=() |
| 744 | [[ $# -gt 0 ]] && logout_args+=("$@") |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 745 | |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 746 | get_gh_hostname logout_args |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 747 | |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 748 | banner "${logout_args[@]}" |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 749 | func_echo "$gh_cmd auth logout ${logout_args[*]} <<< 'Y'" |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 750 | "$gh_cmd" auth logout "${logout_args[@]}" <<< 'Y' |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 751 | |
| 752 | unset active_login |
| 753 | return |
| 754 | } |
| 755 | |
| 756 | ## ----------------------------------------------------------------------- |
| 757 | ## Intent: Query for repository version strings |
| 758 | ## ----------------------------------------------------------------------- |
| 759 | function get_releases() |
| 760 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 761 | declare -n refA="$1"; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 762 | |
| 763 | banner "" |
| 764 | pushd "$scratch" >/dev/null |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 765 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 766 | # gh api repos/{owner}/{repo}/releases |
| 767 | local releases_uri |
| 768 | get_gh_releases releases_uri |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 769 | # declare -p releases_uri |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 770 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 771 | refA=() |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 772 | "$gh_cmd" api "$releases_uri" | jq . > 'release.raw' |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 773 | readarray -t __tmp < <(jq '.[] | "\(.tag_name)"' 'release.raw') |
| 774 | |
| 775 | local release |
| 776 | for release in "${__tmp[@]}"; |
| 777 | do |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 778 | release="${release//\"/}" |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 779 | refA+=("$release") |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 780 | done |
| 781 | |
| 782 | popd >/dev/null |
| 783 | return |
| 784 | } |
| 785 | |
| 786 | ## ----------------------------------------------------------------------- |
| 787 | ## Intent: Display repository query strings. |
| 788 | ## Indirect: verify authentication and API |
| 789 | ## ----------------------------------------------------------------------- |
| 790 | function showReleases() |
| 791 | { |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 792 | declare -a raw=() |
| 793 | get_releases raw |
| 794 | |
| 795 | ## Sort for display, we may need to prune volume later on |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 796 | readarray -t releases < <(sort -nr <<<"${raw[*]}") |
| 797 | # IFS=$'\n' releases=($(sort -nr <<<"${raw[*]}")) |
| 798 | # unset IFS |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 799 | |
| 800 | local release |
| 801 | for release in "${releases[@]}"; |
| 802 | do |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 803 | func_echo "$release" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 804 | done |
| 805 | return |
| 806 | } |
| 807 | |
| 808 | ## ----------------------------------------------------------------------- |
| 809 | ## Intent: Install the gh command line tool locally |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 810 | ## ----------------------------------------------------------------------- |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 811 | function install_gh_binary() |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 812 | { |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 813 | banner |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 814 | |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 815 | pushd "$scratch" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 816 | func_echo "Retrieve latest gh download URLs" |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 817 | |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 818 | local latest="https://github.com/cli/cli/releases/latest" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 819 | local tarball="gh.tar.tgz" |
| 820 | |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 821 | readarray -t latest < <(\ |
| 822 | curl --silent -qI "$latest" \ |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 823 | | awk -F '/' '/^location/ {print substr($NF, 1, length($NF)-1)}') |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 824 | declare -p latest |
| 825 | if [ ${#latest[@]} -ne 1 ]; then |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 826 | error "Unable to determine latest gh package version" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 827 | fi |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 828 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 829 | local VER="${latest[0]}" |
| 830 | |
| 831 | func_echo "Download latest gh binary" |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 832 | local url="https://github.com/cli/cli/releases/download/${VER}/gh_${VER#v}_linux_amd64.tar.gz" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 833 | func_echo "wget --quiet --output-document='$tarball' '$url'" |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 834 | wget --quiet --output-document="$tarball" "$url" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 835 | |
| 836 | func_echo "Unpack tarball" |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 837 | tar zxf "$tarball" |
| 838 | |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 839 | declare -g gh_cmd |
| 840 | gh_cmd="$(find "${scratch}" -name 'gh' -print)" |
| 841 | #declare -g gh_cmd='/usr/bin/gh' |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 842 | readonly gh_cmd |
| 843 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 844 | func_echo "Command: ${gh_cmd}" |
| 845 | func_echo "Version: $("$gh_cmd" --version)" |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 846 | popd |
| 847 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 848 | return |
| 849 | } |
| 850 | |
| 851 | ## ----------------------------------------------------------------------- |
| 852 | ## Intent: Danger Will Robinson |
| 853 | ## ----------------------------------------------------------------------- |
| 854 | function releaseDelete() |
| 855 | { |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 856 | declare -n refA=$1; shift |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 857 | local version="$1"; shift |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 858 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 859 | banner "${refA[@]}" |
| 860 | # declare -a refA=() |
| 861 | refA+=('--host-repo') |
| 862 | refA+=('--yes') |
| 863 | # refA+=('--cleanup-tag') |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 864 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 865 | echo |
| 866 | echo "===========================================================================" |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 867 | my_gh 'release' 'delete' "$version" "${refA[@]}" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 868 | echo "===========================================================================" |
| 869 | echo |
| 870 | |
| 871 | showReleases |
| 872 | return |
| 873 | } |
| 874 | |
| 875 | ## ----------------------------------------------------------------------- |
| 876 | ## Intent: Copy binaries into temp/release, checksum then publish |
| 877 | ## ----------------------------------------------------------------------- |
| 878 | function release_staging() |
| 879 | { |
| 880 | local release_temp |
| 881 | get_release_dir release_temp |
| 882 | |
| 883 | banner '' |
| 884 | func_echo "Packaging release files" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 885 | |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 886 | pushd "$release_temp" >/dev/null \ |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 887 | || error "pushd failed: dir is [$release_temp]" |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 888 | |
| 889 | declare -a to_release=() |
| 890 | get_artifacts '.' to_release |
| 891 | |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 892 | if false; then |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 893 | for fyl in "${to_release[@]}"; |
| 894 | do |
| 895 | func_echo "sha256sum $fyl > ${fyl}.sha256" |
| 896 | sha256sum "$fyl" > "${fyl}.sha256" |
| 897 | done |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 898 | fi |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 899 | |
| 900 | # Generate and check checksums |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 901 | sha256sum -- * | grep -iv -e 'checksum' -e 'sha256' > checksum.SHA256 |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 902 | sha256sum -c < checksum.SHA256 |
| 903 | |
| 904 | echo |
| 905 | func_echo "Checksums(checksum.SHA256):" |
| 906 | cat checksum.SHA256 |
| 907 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 908 | if false; then |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 909 | # Careful with credentials display |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 910 | get_gh_hostname login_args |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 911 | banner "gh auth status ${login_args[*]}" |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 912 | gh auth status "${login_args[@]}" |
| 913 | fi |
| 914 | |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 915 | gh_release_create # publish |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 916 | |
| 917 | popd >/dev/null || error "pushd failed: dir is [$release_temp]" |
| 918 | |
| 919 | return |
| 920 | } |
| 921 | |
| 922 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 923 | ## Intent: Normalize common arguments and access to the gh command. |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 924 | ## o Cache path to the gh command |
| 925 | ## o Construct a gh command line from given args |
| 926 | ## o Command wrapper can provide defaults (--hostname github.com) |
| 927 | ## ----------------------------------------------------------------------- |
| 928 | ## Given: |
| 929 | ## scalar Array variable name (declare -n is a reference) |
| 930 | ## Return: |
| 931 | ## ref gh command line passed back to caller |
| 932 | ## Switches: |
| 933 | ## --host Pass default github hostname |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 934 | ## --verbose Enable verbose mode |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 935 | ## --version Display command version |
| 936 | ## @array Remaining arguments passed as command switches. |
| 937 | ## ----------------------------------------------------------------------- |
| 938 | ## See Also: |
| 939 | ## o https://cli.github.com/manual |
| 940 | ## ----------------------------------------------------------------------- |
| 941 | function my_gh() |
| 942 | { |
Joey Armstrong | 73bb2f6 | 2023-04-17 19:31:50 -0400 | [diff] [blame] | 943 | func_echo "ENTER" |
| 944 | set -x |
| 945 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 946 | declare -a cmd=() |
| 947 | cmd+=("$gh_cmd") |
| 948 | |
| 949 | ## ---------------------- |
| 950 | ## Construct command line |
| 951 | ## ---------------------- |
| 952 | # shellcheck disable=SC2034 |
| 953 | declare -A action=() # pending operations |
| 954 | declare -a args=() # common gh command line args |
| 955 | |
| 956 | while [ $# -gt 0 ]; do |
| 957 | local arg="$1"; shift |
Joey Armstrong | 73bb2f6 | 2023-04-17 19:31:50 -0400 | [diff] [blame] | 958 | func_echo "function arg is [$arg]" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 959 | case "$arg" in |
| 960 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 961 | # Modes |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 962 | -*debug) |
| 963 | # shellcheck disable=SC2034 |
| 964 | declare -i -g debug=1 |
| 965 | ;; |
| 966 | -*verbose) args+=('--verbose') ;; |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 967 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 968 | -*hostname) |
| 969 | get_gh_hostname in_args |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 970 | ;; |
| 971 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 972 | --host-repo) |
| 973 | local val |
| 974 | get_argv_repo val |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 975 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 976 | # --repo <[HOST/]OWNER/REPO> |
Joey Armstrong | 78cecc5 | 2023-04-03 11:39:11 -0400 | [diff] [blame] | 977 | args+=('--repo' "${__githost}/${val}") |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 978 | ;; |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 979 | |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 980 | # args+=('--repo' 'github.com/opencord/bbsim') |
| 981 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 982 | --repo) |
| 983 | local val |
| 984 | get_argv_repo val |
| 985 | args+=('--repo' "$val") |
| 986 | ;; |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 987 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 988 | --tag) |
| 989 | local val |
| 990 | get_argv_tag val |
Joey Armstrong | 4dbe700 | 2023-04-04 12:47:38 -0400 | [diff] [blame] | 991 | args+=("$val") # No switch, pass inline |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 992 | ;; |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 993 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 994 | --title) |
| 995 | local val |
| 996 | get_argv_name val |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 997 | args+=('--title' "'$val'") |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 998 | ;; |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 999 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1000 | *) args+=("$arg") ;; |
| 1001 | esac |
| 1002 | done |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 1003 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1004 | cmd+=("${args[@]}") |
Joey Armstrong | 73bb2f6 | 2023-04-17 19:31:50 -0400 | [diff] [blame] | 1005 | |
| 1006 | echo |
| 1007 | declare -p cmd |
| 1008 | |
| 1009 | echo |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1010 | echo "** Running: ${cmd[*]}" |
| 1011 | "${cmd[@]}" |
| 1012 | local status=$? |
| 1013 | |
Joey Armstrong | 73bb2f6 | 2023-04-17 19:31:50 -0400 | [diff] [blame] | 1014 | set +x |
| 1015 | func_echo "LEAVE" |
| 1016 | |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1017 | if [[ $status -eq 0 ]]; then |
| 1018 | true |
| 1019 | else |
| 1020 | false |
| 1021 | fi |
| 1022 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1023 | return |
| 1024 | } |
| 1025 | |
| 1026 | ## --------------------------------------------------------------------------- |
| 1027 | ## Intent: |
| 1028 | ## --------------------------------------------------------------------------- |
| 1029 | function usage() |
| 1030 | { |
| 1031 | cat <<EOH |
Joey Armstrong | 76026b7 | 2023-03-29 12:19:17 -0400 | [diff] [blame] | 1032 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1033 | Usage: $0 |
| 1034 | Usage: make [options] [target] ... |
| 1035 | --help This mesage |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1036 | --pac Personal Access Token (path to containing file or a string) |
| 1037 | --repo-name ex: voltctl |
| 1038 | --repo-org ex: opencord |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1039 | --release-notes [f] Release notes are passed by file argument |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1040 | |
| 1041 | [DEBUG] |
| 1042 | --gen-version Generate a random release version string. |
| 1043 | --git-hostname Git server hostname (default=github.com) |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1044 | --version-file Read version string from local version file (vs env var) |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 1045 | |
| 1046 | [MODES] |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1047 | --debug Enable script debug mode |
| 1048 | --draft Create a draft release (vs published) |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1049 | --dry-run Simulation mode |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1050 | --todo Display future enhancement list |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1051 | |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1052 | All other arguments are pass-through to the gh command. |
| 1053 | |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1054 | Usage: $0 --draft --repo-org opencord --repo-name voltctl --git-hostname github.com --pac ~/access.pac |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1055 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1056 | EOH |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1057 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1058 | return |
| 1059 | } |
| 1060 | |
| 1061 | ## --------------------------------------------------------------------------- |
| 1062 | ## Intent: Parse script command line arguments |
| 1063 | ## --------------------------------------------------------------------------- |
| 1064 | function parse_args() |
| 1065 | { |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1066 | [[ -v DEBUG ]] && func_echo "ENTER" |
| 1067 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1068 | while [ $# -gt 0 ]; do |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1069 | local arg="$1"; shift |
| 1070 | func_echo "ARGV: $arg" |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 1071 | |
| 1072 | # shellcheck disable=SC2034 |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1073 | case "$arg" in |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1074 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1075 | -*debug) declare -i -g debug=1 ;; |
| 1076 | --draft) declare -i -g draft_release=1 ;; |
| 1077 | --dry-run) declare -i -g dry_run=1 ;; |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1078 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1079 | --version-file) |
| 1080 | declare -i -g argv_version_file=1 |
| 1081 | ;; |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1082 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1083 | -*gen-version) |
| 1084 | declare -g -i argv_gen_version=1 |
| 1085 | ;; |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1086 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1087 | -*git-hostname) |
| 1088 | __githost="$1"; shift |
| 1089 | ;; |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1090 | |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1091 | -*release-notes) |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1092 | [[ ! -f "$1" ]] && error "--release-notes: file path required (arg=\"$arg\")" |
| 1093 | declare -g release_notes="$1"; shift |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 1094 | ;; |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1095 | |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1096 | -*repo-name) |
| 1097 | __repo_name="$1"; shift |
| 1098 | ;; |
| 1099 | |
| 1100 | -*repo-org) |
| 1101 | __repo_org="$1"; shift |
| 1102 | ;; |
| 1103 | |
| 1104 | -*pac) |
| 1105 | declare -g pac="$1"; shift |
| 1106 | readonly pac |
| 1107 | [[ ! -f "$pac" ]] && error "--token= does not exist ($pac)" |
| 1108 | : # nop/true |
| 1109 | ;; |
| 1110 | |
| 1111 | -*todo) todo ;; |
| 1112 | |
| 1113 | -*help) |
| 1114 | usage |
| 1115 | exit 0 |
| 1116 | ;; |
| 1117 | |
| 1118 | *) error "Detected unknown argument $arg" ;; |
| 1119 | esac |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1120 | done |
| 1121 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 1122 | return |
| 1123 | } |
| 1124 | |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 1125 | ##----------------## |
| 1126 | ##---] MAIN [---## |
| 1127 | ##----------------## |
Joey Armstrong | 1962bcf | 2023-01-27 13:53:18 -0500 | [diff] [blame] | 1128 | iam="${0##*/}" |
| 1129 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1130 | full_banner |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1131 | parse_args "$@" |
Joey Armstrong | d99e3d2 | 2023-01-29 12:35:43 -0500 | [diff] [blame] | 1132 | init |
| 1133 | install_gh_binary |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 1134 | |
Joey Armstrong | 01e4edb | 2023-08-18 12:50:32 -0400 | [diff] [blame] | 1135 | do_login "$*" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 1136 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1137 | release_path='/dev/null' |
| 1138 | get_release_path release_path |
| 1139 | declare -p release_path |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 1140 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1141 | pushd "$release_path" || error "pushd failed: dir is [$release_path]" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 1142 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1143 | # legacy: getGitVersion "$GERRIT_PROJECT" GIT_VERSION |
| 1144 | getGitVersion GIT_VERSION |
| 1145 | getReleaseDescription RELEASE_DESCRIPTION |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1146 | if [[ ! -v release_notes ]]; then |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1147 | func_echo "Generating release notes from RELEASE_DESCRIPTION" |
Joey Armstrong | f9a0a88 | 2023-04-17 11:53:57 -0400 | [diff] [blame] | 1148 | declare -g release_notes="$scratch/release.notes" |
| 1149 | echo "$RELEASE_DESCRIPTION" > "$release_notes" |
Joey Armstrong | 55fe80e | 2023-04-05 18:32:14 -0400 | [diff] [blame] | 1150 | fi |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1151 | cat "$release_notes" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 1152 | |
Joey Armstrong | eef8c2c | 2023-03-27 17:27:43 -0400 | [diff] [blame] | 1153 | cat <<EOM |
| 1154 | |
| 1155 | ** ----------------------------------------------------------------------- |
| 1156 | ** GIT VERSION: $(declare -p GIT_VERSION) |
| 1157 | ** RELEASE_DESCRIPTION: $(declare -p RELEASE_DESCRIPTION) |
| 1158 | ** RELEASE_TARGETS: $(declare -p RELEASE_TARGETS) |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1159 | ** ----------------------------------------------------------------------- |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1160 | ** URL: https://github.com/opencord/bbsim/releases |
| 1161 | ** ----------------------------------------------------------------------- |
Joey Armstrong | 43c4842 | 2023-04-03 10:17:32 -0400 | [diff] [blame] | 1162 | ** Running: make ${RELEASE_TARGETS} |
Joey Armstrong | eef8c2c | 2023-03-27 17:27:43 -0400 | [diff] [blame] | 1163 | ** ----------------------------------------------------------------------- |
| 1164 | EOM |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1165 | # build the release, can be multiple space separated targets |
| 1166 | # ----------------------------------------------------------------------- |
| 1167 | # % go build command-line-arguments: |
| 1168 | # copying /tmp/go-build4212845548/b001/exe/a.out: |
| 1169 | # open release/voltctl-1.8.25-linux-amd64: permission denied |
| 1170 | # missing: docker run mkdir |
| 1171 | # ----------------------------------------------------------------------- |
| 1172 | # shellcheck disable=SC2086 |
Joey Armstrong | eef8c2c | 2023-03-27 17:27:43 -0400 | [diff] [blame] | 1173 | make "$RELEASE_TARGETS" |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1174 | copyToRelease |
Joey Armstrong | 50f6e0b | 2023-01-24 14:14:08 -0500 | [diff] [blame] | 1175 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 1176 | cat <<EOM |
Joey Armstrong | 1962bcf | 2023-01-27 13:53:18 -0500 | [diff] [blame] | 1177 | |
| 1178 | ** ----------------------------------------------------------------------- |
| 1179 | ** Create the release: |
| 1180 | ** 1) Create initial github release with download area. |
| 1181 | ** 2) Generate checksum.SHA256 for all released files. |
| 1182 | ** 3) Upload files to complete the release. |
Joey Armstrong | 75a0d93 | 2023-03-28 08:59:54 -0400 | [diff] [blame] | 1183 | ** 4) Display released info from github |
Joey Armstrong | 1962bcf | 2023-01-27 13:53:18 -0500 | [diff] [blame] | 1184 | ** ----------------------------------------------------------------------- |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 1185 | EOM |
| 1186 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1187 | showReleases |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1188 | release_staging |
Joey Armstrong | e8560da | 2023-04-26 15:44:45 -0400 | [diff] [blame] | 1189 | |
| 1190 | # Useful to display but --draft images use a non-standard subdir identifier. |
| 1191 | # showReleaseUrl |
| 1192 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1193 | popd || error "pushd failed: dir is [$release_path]" |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 1194 | |
Joey Armstrong | 2097d3e | 2023-03-26 10:32:03 -0400 | [diff] [blame] | 1195 | do_logout |
| 1196 | |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 1197 | # [SEE ALSO] |
| 1198 | # ----------------------------------------------------------------------- |
| 1199 | # https://www.shellcheck.net/wiki/SC2236 |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame] | 1200 | # https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 1201 | # ----------------------------------------------------------------------- |
Joey Armstrong | f085d87 | 2023-01-28 17:52:29 -0500 | [diff] [blame] | 1202 | # https://cli.github.com/manual/gh_help_reference |
| 1203 | # https://cli.github.com/manual/gh_release |
| 1204 | # ----------------------------------------------------------------------- |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 1205 | |
| 1206 | # [EOF] |