Daniele Moro | 8a8b572 | 2021-03-04 11:57:55 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # ----------------------------------------------------------------------------- |
| 3 | # Builds the snapshot artifacts and uploads them. |
| 4 | # ----------------------------------------------------------------------------- |
| 5 | |
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 |
| 7 | # shellcheck disable=SC1090 |
| 8 | . "$ONOS_ROOT"/tools/build/envDefaults |
| 9 | |
| 10 | set -ex -o pipefail |
| 11 | |
| 12 | DRY_RUN=${1:-""} |
| 13 | dryRun=0 |
| 14 | if [ "${DRY_RUN}" == "--dry-run" ]; then |
| 15 | dryRun=1 |
| 16 | fi |
| 17 | |
| 18 | [[ ! "$ONOS_POM_VERSION" =~ "SNAPSHOT" ]] && echo "Version is not a SNAPSHOT" && exit 1; |
| 19 | |
| 20 | cd "$ONOS_ROOT" |
| 21 | |
| 22 | # Build ONOS |
| 23 | bazel build onos |
| 24 | |
| 25 | if [ $dryRun -eq 0 ]; then |
| 26 | publish_url="https://oss.sonatype.org/content/repositories/snapshots/" |
| 27 | else |
| 28 | publish_url="" |
| 29 | fi |
| 30 | |
| 31 | # Create artifact catalog |
| 32 | onos-publish-catalog publishing-catalog-snapshot |
| 33 | |
| 34 | # publish artifacts with Maven |
| 35 | if [ $dryRun -eq 0 ]; then |
| 36 | onos-maven-upload.py publishing-catalog-snapshot "${publish_url}" |
| 37 | else |
| 38 | onos-maven-upload.py publishing-catalog-snapshot "${publish_url}" --dry_run |
| 39 | fi |