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 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2018-2023 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 | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 23 | ##-------------------## |
| 24 | ##---] GLOBALS [---## |
| 25 | ##-------------------## |
| 26 | declare -g SCRIPT_VERSION='1.0' # git changeset needed |
| 27 | declare -g TRACE=1 # uncomment to set -x |
| 28 | declare -g ARGV="$*" # archive for display |
| 29 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 30 | declare -g RELEASE_TEMP |
| 31 | |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 32 | ##--------------------## |
| 33 | ##---] INCLUDES [---## |
| 34 | ##--------------------## |
| 35 | declare -g pgmdir="${0%/*}" # dirname($script) |
Joey Armstrong | bd54b57 | 2023-01-25 14:28:10 -0500 | [diff] [blame] | 36 | echo "** ${0}: PWD=$(/bin/pwd)" |
| 37 | find . -maxdepth 1 -ls |
| 38 | |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 39 | declare -a common_args=() |
| 40 | common_args+=('--common-args-begin--') |
| 41 | common_args+=('--traputils') |
| 42 | common_args+=('--stacktrace') |
| 43 | # common_args+=('--tempdir') |
| 44 | |
Joey Armstrong | d8b6f33 | 2023-01-25 18:35:17 -0500 | [diff] [blame] | 45 | # ----------------------------------------------------------------------- |
| 46 | # Jenkins must have checked out/copied the script -vs- repository |
| 47 | # ----------------------------------------------------------------------- |
| 48 | # 17:56:27 [github-release_voltctl] $ /usr/bin/env bash /tmp/jenkins1043949650153731384.sh |
| 49 | # 17:56:27 ** /tmp/jenkins1043949650153731384.sh: PWD=/w/workspace/github-release_voltctl |
| 50 | # 17:56:27 5120009 4 drwxrwxr-x 4 jenkins jenkins 4096 Jan 25 22:56 . |
| 51 | # 17:56:27 5120010 4 drwxrwxr-x 9 jenkins jenkins 4096 Jan 25 22:56 ./voltctl |
| 52 | # 17:56:27 5120036 4 drwxrwxr-x 2 jenkins jenkins 4096 Jan 25 22:56 ./voltctl@tmp |
| 53 | # 17:56:27 /tmp/jenkins1043949650153731384.sh: line 44: /tmp/common/common.sh: No such file or directory |
| 54 | # ----------------------------------------------------------------------- |
| 55 | |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 56 | # shellcheck disable=SC1091 |
| 57 | source "${pgmdir}/common/common.sh" "${common_args[@]}" |
| 58 | |
| 59 | ## ----------------------------------------------------------------------- |
| 60 | ## Intent: Output a log banner to identify the running script/version. |
| 61 | ## ----------------------------------------------------------------------- |
| 62 | ## TODO: |
| 63 | ## o SCRIPT_VERSION => git changeset for repo:ci-managment |
| 64 | ## o echo "library version: ${env."library.libName.version"}" |
| 65 | # ----------------------------------------------------------------------- |
| 66 | # 14:18:38 > git fetch --no-tags --progress -- https://gerrit.opencord.org/ci-management.git +refs/heads/*:refs/remotes/origin/* # timeout=10 |
| 67 | # 14:18:39 Checking out Revision 50f6e0b97f449b32d32ec0e02d59642000351847 (master) |
| 68 | # ----------------------------------------------------------------------- |
| 69 | function banner() |
| 70 | { |
| 71 | local iam="${0##*/}" |
| 72 | |
| 73 | cat <<EOH |
| 74 | |
| 75 | ** ----------------------------------------------------------------------- |
| 76 | ** IAM: ${iam} :: ${FUNCNAME[0]} |
| 77 | ** ARGV: ${ARGV} |
| 78 | ** PWD: $(/bin/pwd) |
| 79 | ** NOW: $(date '+%Y/%m/%d %H:%M:%S') |
| 80 | ** VER: ${SCRIPT_VERSION:-'unknown'} |
| 81 | ** ----------------------------------------------------------------------- |
| 82 | EOH |
| 83 | |
| 84 | return |
| 85 | } |
| 86 | |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 87 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 50f6e0b | 2023-01-24 14:14:08 -0500 | [diff] [blame] | 88 | ## Intent: |
| 89 | ## Display available command versions |
| 90 | ## A github release job is failing due to a command being mia. |
| 91 | ## ----------------------------------------------------------------------- |
| 92 | function displayCommands() |
| 93 | { |
| 94 | # which git || /bin/true |
| 95 | # git --version || /bin/true |
| 96 | # go version || /bin/true |
| 97 | # helm version || /bin/true |
| 98 | return |
| 99 | } |
| 100 | |
| 101 | ## ----------------------------------------------------------------------- |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 102 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 103 | function doDebug() |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 104 | { |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 105 | echo "** ${FUNCNAME[0]}: ENTER" |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 106 | |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 107 | echo |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 108 | echo "** PWD: $(/bin/pwd)" |
| 109 | echo "** make-pre: $(/bin/ls -l)" |
| 110 | echo |
| 111 | |
| 112 | declare -p ARTIFACT_GLOB |
| 113 | declare -p RELEASE_TEMP |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 114 | |
| 115 | echo |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 116 | echo "** ${FUNCNAME[0]}: ARTIFACT_GLOB=${ARTIFACT_GLOB}" |
| 117 | local artifact_glob="${ARTIFACT_GLOB%/*}" |
| 118 | declare -p artifact_glob |
Joey Armstrong | bd54b57 | 2023-01-25 14:28:10 -0500 | [diff] [blame] | 119 | |
| 120 | echo "** ${FUNCNAME[0]}: PWD=$(/bin/pwd)" |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 121 | find "$artifact_glob" -print || /bin/true |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 122 | |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 123 | # Copy artifacts into the release temp dir |
| 124 | # shellcheck disable=SC2086 |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 125 | # cp -v "$ARTIFACT_GLOB" "$RELEASE_TEMP" |
Joey Armstrong | d8b6f33 | 2023-01-25 18:35:17 -0500 | [diff] [blame] | 126 | echo "rsync -rv --checksum \"$artifact_glob/.\" \"$RELEASE_TEMP/.\"" |
| 127 | rsync -rv --checksum "$artifact_glob/." "$RELEASE_TEMP/." |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 128 | |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 129 | echo |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 130 | echo "** ${FUNCNAME[0]}: RELEASE_TEMP=${RELEASE_TEMP}" |
| 131 | find "$RELEASE_TEMP" -print || /bin/true |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 132 | |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 133 | echo "** ${FUNCNAME[0]}: LEAVE" |
| 134 | echo |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 135 | return |
| 136 | } |
| 137 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 138 | ## ----------------------------------------------------------------------- |
| 139 | ## ----------------------------------------------------------------------- |
| 140 | function copyToRelease() |
| 141 | { |
| 142 | local iam="${FUNCNAME[0]}" |
| 143 | echo "** ${iam}: ENTER" |
| 144 | |
| 145 | local artifact_glob="${ARTIFACT_GLOB%/*}" |
| 146 | echo "** ${iam}: $(declare -p ARTIFACT_GLOB) $(declare -p artifact_glob)" |
| 147 | find "$artifact_glob" -print |
| 148 | |
| 149 | # Copy artifacts into the release temp dir |
| 150 | # shellcheck disable=SC2086 |
| 151 | # cp -v "$ARTIFACT_GLOB" "$RELEASE_TEMP" |
| 152 | echo "rsync -rv --checksum \"$artifact_glob/.\" \"$RELEASE_TEMP/.\"" |
| 153 | rsync -rv --checksum "$artifact_glob/." "$RELEASE_TEMP/." |
| 154 | |
| 155 | echo "** ${iam}: RELEASE_TEMP=${RELEASE_TEMP}" |
| 156 | find "$RELEASE_TEMP" -print |
| 157 | |
| 158 | echo "** ${iam}: LEAVE" |
| 159 | echo |
| 160 | return |
| 161 | } |
| 162 | |
| 163 | ## ----------------------------------------------------------------------- |
| 164 | ## ----------------------------------------------------------------------- |
| 165 | function showGithubRelease() |
| 166 | { |
| 167 | local iam="${FUNCNAME[0]}" |
| 168 | echo "** ${iam}: ENTER" |
| 169 | |
| 170 | echo "** ${iam}: which github-release: $(which -a github-release)" |
| 171 | local switch |
| 172 | for switch in '--version' '--help'; |
| 173 | do |
| 174 | echo "** ${iam}: github-release ${switch}: $(github-release ${switch})" |
| 175 | done |
| 176 | echo "** ${iam}: LEAVE" |
| 177 | echo |
| 178 | return |
| 179 | } |
| 180 | |
| 181 | ## ----------------------------------------------------------------------- |
| 182 | ## ----------------------------------------------------------------------- |
| 183 | function showReleaseInfo() |
| 184 | { |
| 185 | local user="$1" ; shift |
| 186 | local repo="$1" ; shift |
| 187 | local tag='' |
| 188 | if [ $# -gt 0 ]; then |
| 189 | tag="$1" ; shift |
| 190 | fi |
| 191 | |
| 192 | local iam="${FUNCNAME[0]}" |
| 193 | echo "** ${iam}: ENTER" |
| 194 | |
| 195 | cat <<EOM |
| 196 | |
| 197 | ** ------------------------------------------------------------------- |
| 198 | ** ${iam} |
| 199 | ** ------------------------------------------------------------------- |
| 200 | EOM |
| 201 | |
| 202 | declare -a args=() |
| 203 | args+=('--user' "$user") |
| 204 | args+=('--repo' "$repo") |
| 205 | if [ ${#tag} -gt 0 ]; then |
| 206 | args+=('--tag' "$tag") |
| 207 | fi |
| 208 | |
| 209 | echo "${iam}: github-relase info" |
| 210 | github-release\ |
| 211 | --verbose\ |
| 212 | info\ |
| 213 | "${args[@]}" |
| 214 | |
| 215 | echo "** ${iam}: LEAVE" |
| 216 | return |
| 217 | } |
| 218 | |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 219 | ##----------------## |
| 220 | ##---] MAIN [---## |
| 221 | ##----------------## |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 222 | set -eu -o pipefail |
| 223 | |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 224 | banner |
| 225 | |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 226 | # when not running under Jenkins, use current dir as workspace and a blank |
| 227 | # project name |
| 228 | WORKSPACE=${WORKSPACE:-.} |
| 229 | GERRIT_PROJECT=${GERRIT_PROJECT:-} |
| 230 | |
| 231 | # Github organization (or user) this project is published on. Project name should |
| 232 | # be the same on both Gerrit and GitHub |
| 233 | GITHUB_ORGANIZATION=${GITHUB_ORGANIZATION:-} |
| 234 | |
| 235 | # glob pattern relative to project dir matching release artifacts |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 236 | # ARTIFACT_GLOB=${ARTIFACT_GLOB:-"release/*"} # stat -- release/* not found, literal string (?) |
Joey Armstrong | 50f6e0b | 2023-01-24 14:14:08 -0500 | [diff] [blame] | 237 | ARTIFACT_GLOB=${ARTIFACT_GLOB:-"release/."} |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 238 | |
| 239 | # Temporary staging directory to copy artifacts to |
| 240 | RELEASE_TEMP="$WORKSPACE/release" |
Zack Williams | 2f8e847 | 2019-05-21 16:29:06 -0700 | [diff] [blame] | 241 | mkdir -p "$RELEASE_TEMP" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 242 | |
| 243 | # Use "release" as the default makefile target, can be a space separated list |
| 244 | RELEASE_TARGETS=${RELEASE_TARGETS:-release} |
| 245 | |
Zack Williams | 0f39849 | 2019-10-23 16:02:24 -0700 | [diff] [blame] | 246 | |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 247 | # check that we're on a semver released version, or exit |
| 248 | pushd "$GERRIT_PROJECT" |
| 249 | GIT_VERSION=$(git tag -l --points-at HEAD) |
| 250 | |
Zack Williams | 6e070f5 | 2019-10-04 11:08:59 -0700 | [diff] [blame] | 251 | # match bare versions or v-prefixed golang style version |
| 252 | if [[ "$GIT_VERSION" =~ ^v?([0-9]+)\.([0-9]+)\.([0-9]+)$ ]] |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 253 | then |
| 254 | echo "git has a SemVer released version tag: '$GIT_VERSION'" |
| 255 | echo "Building artifacts for GitHub release." |
| 256 | else |
| 257 | echo "No SemVer released version tag found, exiting..." |
| 258 | exit 0 |
| 259 | fi |
| 260 | popd |
| 261 | |
Zack Williams | 0f39849 | 2019-10-23 16:02:24 -0700 | [diff] [blame] | 262 | # Set and handle GOPATH and PATH |
| 263 | export GOPATH=${GOPATH:-$WORKSPACE/go} |
| 264 | export PATH=$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:$GOPATH/bin |
| 265 | |
| 266 | # To support golang projects that require GOPATH to be set and code checked out there |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 267 | # If $DEST_GOPATH is not an empty string: |
Zack Williams | 76356cb | 2019-08-30 10:44:42 -0700 | [diff] [blame] | 268 | # - create GOPATH within WORKSPACE, and destination directory within |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 269 | # - set PATH to include $GOPATH/bin and the system go binaries |
Zack Williams | 76356cb | 2019-08-30 10:44:42 -0700 | [diff] [blame] | 270 | # - move project from $WORKSPACE/$GERRIT_PROJECT to new location in $GOPATH |
| 271 | # - start release process within that directory |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 272 | |
| 273 | DEST_GOPATH=${DEST_GOPATH:-} |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 274 | if [ -n "$DEST_GOPATH" ]; then |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 275 | mkdir -p "$GOPATH/src/$DEST_GOPATH" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 276 | release_path="$GOPATH/src/$DEST_GOPATH/$GERRIT_PROJECT" |
Zack Williams | 76356cb | 2019-08-30 10:44:42 -0700 | [diff] [blame] | 277 | mv "$WORKSPACE/$GERRIT_PROJECT" "$release_path" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 278 | else |
| 279 | release_path="$WORKSPACE/$GERRIT_PROJECT" |
| 280 | fi |
| 281 | |
| 282 | if [ ! -f "$release_path/Makefile" ]; then |
| 283 | echo "Makefile not found at $release_path!" |
| 284 | exit 1 |
| 285 | else |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 286 | |
Joey Armstrong | 7f382ef | 2023-01-25 12:00:08 -0500 | [diff] [blame] | 287 | declare -p release_path |
| 288 | |
| 289 | # shellcheck disable=SC2015 |
| 290 | [[ -v TRACE ]] && { set -x; } || { set +x; } # SC2015 (shellcheck -x) |
| 291 | |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 292 | pushd "$release_path" |
| 293 | |
| 294 | # Release description is sanitized version of the log message |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 295 | RELEASE_DESCRIPTION="$(git log -1 --pretty=%B | tr -dc "[:alnum:]\n\r\.\[\]\:\-\\\/\`\' ")" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 296 | |
| 297 | # build the release, can be multiple space separated targets |
| 298 | # shellcheck disable=SC2086 |
Joey Armstrong | af577ab | 2022-12-15 14:43:33 -0500 | [diff] [blame] | 299 | make "$RELEASE_TARGETS" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 300 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 301 | # doDebug # deterine why ARTIFACT_GLOB is empty |
| 302 | copyToRelease |
Joey Armstrong | 50f6e0b | 2023-01-24 14:14:08 -0500 | [diff] [blame] | 303 | |
| 304 | # Are we failing on a literal string "release/*" ? |
Joey Armstrong | 1b443bf | 2023-01-24 10:22:18 -0500 | [diff] [blame] | 305 | # cp -v "$ARTIFACT_GLOB" "$RELEASE_TEMP" |
Joey Armstrong | d8b6f33 | 2023-01-25 18:35:17 -0500 | [diff] [blame] | 306 | # echo "rsync -rv --checksum \"$artifact_glob/.\" \"$RELEASE_TEMP/.\"" |
| 307 | # rsync -rv --checksum "$artifact_glob/." "$RELEASE_TEMP/." |
Joey Armstrong | 50f6e0b | 2023-01-24 14:14:08 -0500 | [diff] [blame] | 308 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 309 | echo "PRE-RELEASE INFO" |
| 310 | showReleaseInfo \ |
| 311 | "$GITHUB_ORGANIZATION"\ |
| 312 | "$GERRIT_PROJECT" |
Joey Armstrong | 50f6e0b | 2023-01-24 14:14:08 -0500 | [diff] [blame] | 313 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 314 | showGithubRelease |
| 315 | |
| 316 | cat <<EOM |
| 317 | Create the release in three steps: |
| 318 | 1) Create initial github release with download area. |
| 319 | 2) Generate checksum.SHA256 for all released files. |
| 320 | 3) Upload files to complete the release. |
| 321 | 4) Display released info from github. |
| 322 | EOM |
| 323 | |
| 324 | # Usage: github-release [global options] <verb> [verb options] |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 325 | # create release |
Zack Williams | 0d93d84 | 2019-05-21 17:02:49 -0700 | [diff] [blame] | 326 | echo "Creating Release: $GERRIT_PROJECT - $GIT_VERSION" |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 327 | github-release \ |
| 328 | --verbose \ |
| 329 | release \ |
| 330 | --user "$GITHUB_ORGANIZATION" \ |
| 331 | --repo "$GERRIT_PROJECT" \ |
| 332 | --tag "$GIT_VERSION" \ |
| 333 | --name "$GERRIT_PROJECT - $GIT_VERSION" \ |
| 334 | --description "$RELEASE_DESCRIPTION" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 335 | |
| 336 | # handle release files |
| 337 | pushd "$RELEASE_TEMP" |
| 338 | |
Joey Armstrong | d8b6f33 | 2023-01-25 18:35:17 -0500 | [diff] [blame] | 339 | ## [TODO] Add a content check, err when only source tarballs exist |
| 340 | find . -mindepth 1 -maxdepth 1 ! -type d -ls |
| 341 | |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 342 | # Generate and check checksums |
Zack Williams | 2f8e847 | 2019-05-21 16:29:06 -0700 | [diff] [blame] | 343 | sha256sum -- * > checksum.SHA256 |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 344 | sha256sum -c < checksum.SHA256 |
| 345 | |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 346 | echo "Checksums(checksum.SHA256):" |
Zack Williams | 0d93d84 | 2019-05-21 17:02:49 -0700 | [diff] [blame] | 347 | cat checksum.SHA256 |
| 348 | |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 349 | # upload all files to the release |
Zack Williams | 2f8e847 | 2019-05-21 16:29:06 -0700 | [diff] [blame] | 350 | for rel_file in * |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 351 | do |
Zack Williams | 0d93d84 | 2019-05-21 17:02:49 -0700 | [diff] [blame] | 352 | echo "Uploading file: $rel_file" |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 353 | github-release \ |
| 354 | --verbose \ |
| 355 | upload \ |
| 356 | --user "$GITHUB_ORGANIZATION" \ |
| 357 | --repo "$GERRIT_PROJECT" \ |
| 358 | --tag "$GIT_VERSION" \ |
| 359 | --name "$rel_file" \ |
| 360 | --file "$rel_file" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 361 | done |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 362 | popd |
| 363 | |
| 364 | popd |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 365 | |
| 366 | showReleaseInfo \ |
| 367 | "$GITHUB_ORGANIZATION"\ |
| 368 | "$GERRIT_PROJECT"\ |
| 369 | "$GIT_VERSION" |
Zack Williams | 27cd3e5 | 2018-09-18 16:44:50 -0700 | [diff] [blame] | 370 | fi |
Joey Armstrong | 28eddda | 2023-01-10 03:09:34 -0500 | [diff] [blame] | 371 | |
| 372 | # [SEE ALSO] |
| 373 | # ----------------------------------------------------------------------- |
| 374 | # https://www.shellcheck.net/wiki/SC2236 |
Joey Armstrong | 26707f0 | 2023-01-26 12:41:12 -0500 | [diff] [blame^] | 375 | # 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] | 376 | # ----------------------------------------------------------------------- |
| 377 | |
| 378 | # [EOF] |