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