blob: 006f131b8bdafef8c39285046672e86a741be98e [file] [log] [blame]
Daniele Moro8a8b5722021-03-04 11:57:55 +01001#!/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
10set -ex -o pipefail
11
12DRY_RUN=${1:-""}
13dryRun=0
14if [ "${DRY_RUN}" == "--dry-run" ]; then
15 dryRun=1
16fi
17
18[[ ! "$ONOS_POM_VERSION" =~ "SNAPSHOT" ]] && echo "Version is not a SNAPSHOT" && exit 1;
19
20cd "$ONOS_ROOT"
21
22# Build ONOS
23bazel build onos
24
25if [ $dryRun -eq 0 ]; then
26 publish_url="https://oss.sonatype.org/content/repositories/snapshots/"
27else
28 publish_url=""
29fi
30
31# Create artifact catalog
32onos-publish-catalog publishing-catalog-snapshot
33
34# publish artifacts with Maven
35if [ $dryRun -eq 0 ]; then
36 onos-maven-upload.py publishing-catalog-snapshot "${publish_url}"
37else
38 onos-maven-upload.py publishing-catalog-snapshot "${publish_url}" --dry_run
39fi